- - * - WhiteUnicorn - * - -




* #WhiteUnicorn/ StartPage/ Documentation/DelphiFAQ >


Frequently Asked Questions

Using the WIN API high resolution performance counter

Question:

How can I make use of the high resolution performance counter available under Win32?

Answer:

The following example demonstrates using the TLargeInteger 
type to query the performance counter. Note that the 
TLargeInteger type (64 bit integer) can be converted and 
referenced as a whole by casting it to a Comp type.

Example:

procedure TForm1.Button1Click(Sender: TObject);
var
  li : TLARGEINTEGER;
begin
  QueryPerformanceFrequency(li);
  ShowMessage(FloatToStr(Comp(li)));
  QueryPerformanceCounter(li);
  ShowMessage(FloatToStr(Comp(li)));
  QueryPerformanceCounter(li);
  ShowMessage(FloatToStr(Comp(li)));
end;



* #WhiteUnicorn/ StartPage/ Documentation/DelphiFAQ >



- - * - Anastasija aka WhiteUnicorn - * - - LJLiveJournal
PFPhotoFile