| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- MODULE SeqTest;
- (* Sequential Benchmark *)
- IMPORT InitCompilerMods;
- FROM ModBase3 IMPORT DBFile,InitDBF,OpenDBF,DefaultFixUp;
- FROM DBIndxes IMPORT DBIndex, InitIndex, CloseIndex, FindPositionCh,
- NextRecord, PrevRecord,GoTop,GoBottom;
- FROM Timing IMPORT BeginTimer, ShowUsage;
- IMPORT StringIO;
- IMPORT StrConv;
- CONST
- KeyLen = 30;
- TYPE
- KeyStr = ARRAY [0..KeyLen-1] OF CHAR;
- VAR
- DBF : DBFile;
- NDX : DBIndex;
- DataRef : LONGINT;
- Found : BOOLEAN;
- counter :CARDINAL;
- string :ARRAY[0..79] OF CHAR;
- BEGIN
- BeginTimer();
- counter:=1;
- (* start timer counting *)
- InitDBF('Modbase.DBF',DBF,0,FALSE,TRUE,FALSE,DefaultFixUp);
- IF OpenDBF(DBF) THEN END;
- InitIndex("ModBase.NDX", NDX,DBF, 30,FALSE,TRUE,TRUE);
- GoTop(NDX);
- (* FindPositionCh(NDX, "", Found); *) (* prepare for sequential access *)
- WHILE NextRecord(NDX, DataRef) DO (* step forward through index *)
- INC(counter);
- END (* while *);
- StrConv.CardinalToStr(counter,0,string);
- StringIO.WriteStr(StringIO.outp,string);
- StringIO.WriteEol(StringIO.outp,' Keys found');
- counter:=1;
- (* should change to gotop, gobottom *)
- (* FindPositionCh(NDX, 377C, Found);*)
- GoBottom(NDX); (* prepare for sequential access *)
- WHILE PrevRecord(NDX, DataRef) DO (* step backward through index *)
- INC(counter) ;
- END (* while *);
- StrConv.CardinalToStr(counter,0,string);
- StringIO.WriteStr(StringIO.outp,string);
- StringIO.WriteEol(StringIO.outp,' Keys found');
- CloseIndex(NDX);
- ShowUsage('Seqential test'); (* display elasped time *)
- END SeqTest.
|