Главная страница | назад





Article #17028: Using the WIN API high resolution performance counter

 Question and Answer Database
FAQ2028D.txt Using the WIN API high resolution performance counter
Category :Windows API
Platform :All
Product :All 32 bit
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;
7/16/98 4:31:28 PM

Last Modified: 01-SEP-99