Re: accept ... from time
- From: "Rick Smith" <ricksmith@xxxxxxx>
- Date: Tue, 23 Jan 2007 11:06:47 -0500
<michael.bierenfeld@xxxxxx> wrote in message
news:1169554701.175132.59070@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Hello,
I want to measure the execution time of a sql statement. Can I get the
time in milliseconds to be displayed.
I have
accept START-TIME from time
EXEC SQL SELECT ... something
accept END-TIME from time
DISPLAY "EXECUTION lasted from" START-TIME
DISPLAY " till " END-TIME
START-TIME and END-TIME is pic x(8) this is hh24:mm:ss. But I need
fractions of seconds. How can I do this. Target System is Microfocus
and AIX.
I have used the following for timing.
Resolution is 10 ms for code; but may be different
depending on hardware, OS, etc. For example,
a PC with DOS has a resolution of 55 ms.
-----
data division.
working-storage section.
01 t-start.
03 t-start-hour pic 99.
03 t-start-minute pic 99.
03 t-start-second pic 99v99.
01 t-end.
03 t-end-hour pic 99.
03 t-end-minute pic 99.
03 t-end-second pic 99v99.
77 t-elapsed pic 9(7)v99.
77 t-elapsed-display pic z(6)9.99.
procedure division.
...
accept t-start from time
* insert what is to be timed, here
accept t-end from time
perform display-elapsed
...
display-elapsed section.
if t-start > t-end
* execution past midnight
move 86400 to t-elapsed
else
move 0 to t-elapsed
end-if
compute t-elapsed = t-elapsed
+ (t-end-hour - t-start-hour) * 3600
+ (t-end-minute - t-start-minute) * 60
+ (t-end-second - t-start-second)
end-compute
move t-elapsed to t-elapsed-display
display t-elapsed-display
.
-----
.
- References:
- accept ... from time
- From: michael.bierenfeld@xxxxxx
- accept ... from time
- Prev by Date: Re: accept ... from time
- Next by Date: Re: accept ... from time
- Previous by thread: Re: accept ... from time
- Next by thread: Re: accept ... from time
- Index(es):
Relevant Pages
|
|