Note that there are some explanatory texts on larger screens.

plurals
  1. PODelphi - How to make timer in milliseconds or nanoseconds with start/stop functions?
    text
    copied!<p>I am looking for a timer in milliseconds or nanoseconds in Delphi7. I have to check the speeds of three ISAM files with sequential search. The first ind file contains 50 strings like "record_0" to "record_50". The second - "record_0" to "record_500" and the third - "record_0" to "record_5000". I've implemented everything but I don't know how to make the timer. I am comparing a string with the last item in each ISAM file. Here is my code for the first ind file:</p> <pre><code>procedure TForm1.Button1Click(Sender: TObject); var i:integer; var content : String[20]; var indexCounter:integer; var keyword:string; begin //First ISAM file AssignFile(indF1, 'index1.ind'); ReWrite(indF1); Reset(indF1); for i:=0 to 49 do begin content := 'record_'; content := content + IntToStr(i+1); index1.index1 := content; index1.position1 := FileSize(indF1); Seek(indF1, FileSize(indF1)); write(indF1, index1); end; CloseFile(indF1); Label12.Caption := FileSizeStr('index1.ind'); //Sequential search in first ind file Reset(indF1); keyword := 'record_50'; indexCounter := 0; //start timer while not Eof(indF1) do begin Seek(indF1, indexCounter); Read(indF1, Index1); if (keyword = Index1.index1) then begin //stop timer; //Label20 := milliseconds/nanoseconds; //return/break while loop (result := -1; exit;) ??? end; indexCounter := indexCounter + 1; end; </code></pre> <p>I need a procedure/function so that when I call it it should start counting in milliseconds or nanoseconds and stop when the string is found (it's the last string in each ind file) and show the elapsed time for traversing through all the file. Also I don't know how to break the while loop. Thanks in advance.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload