The question, in fact, in the name of the topic.
Having read about the milliseconds in the Internet, and taking out an example, I wrote a function:
Code: Select all
function TfrSQL.pr_calc_time_work: Extended;
var
Fr, t1, t2: Int64;
Dt: Extended;
begin
// Determine the processor speed (the number of cycles per second).
QueryPerformanceFrequency (Fr);
if Fr = 0 then begin
ShowMessage ('Unable to get information about the frequency.');
Exit;
end;
// Reading the meter reading cycles.
QueryPerformanceCounter (t1);
// Start the process under investigation.
timeBeginPeriod (1);
if fn_decode_sqltype = 'SELECT' then // handwritten function, which returns the type of executable object
// (checked property TOraQuery.sqltype)
ORAQuery1.Open;
if (fn_decode_sqltype = 'UPDATE') or (fn_decode_sqltype = 'INSERT') or (fn_decode_sqltype = 'DELETE') then
ORAQuery1.ExecSQL;
// Readout cycles.
QueryPerformanceCounter (t2);
// Calculating time.
Dt: = RoundTo ((t2 - t1) / Fr, -3);
result: = Dt;
end;
I understand, to guess why someone runs a program without seeing it full of code, it is desirable to have telepathic abilities. But I hope that you will have some ideas.