How to correctly identify execution time "select" and other DML-commands in milliseconds (TOraQuery, in Delphi 7)
Posted: Tue 22 Sep 2015 12:02
Hello, dear. Really need your help.
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:
I tried to compare the results of the "select" and other DML-commands of my program and PLSQL Developer. The results differ. And yet, when it starts in PLSQL Developer same "select" several times most of the results are the same (or slightly different). And if you do the same in my program - the results greatly jump.
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.
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.