Post by RichardPost by m***@web.deI want to measure the execution time of a sql statement. Can I get the
time in milliseconds to be displayed.
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.
You should check first the granularity of the time you receive. If you
accepted the time several times in a loop you may find that you get the
same time for several successive accepts and then a jump to the next
time which may be tens of milliseconds later.
That is all quite true.
Post by RichardThat is there may be only a few different times that you receive in
each second. On PCs you will only get 18 different times in one second
no matter how many accepts are done. On AIX this may be higher.
The first statement is true. The second is false.
I have just verified that at least one existing implementation on
a "PC" provides full centisecond precision, namely Tinycobol 0.63.0
running on FreeBSD on an x86 box (although it has a really nasty
wraparound bug at the seconds level).
I believe that you have misunderstood an implementation artifact
of MS-DOS/PC-DOS and the underlying BIOS. Every IBM-PC architecture
machine has an internal hardware timer that ticks at approximately
a microsecond rate (starting with the first ones back in 1981).
The BIOS uses this timer to generate time interrupts. It uses the
slowest possible interrupt rate of interrupting approximately every
65K ticks (presumably to reduce interrupt processing overhead).
If you divide those out, you will see that interrupts occur about
18 times per second. (The BIOS timer actually ticks at 14318180 /
12 / 65536 HZ, which comes out to the documented 18.2 ticks per
second.)
Numerous third-party PC-DOS and MS-DOS programs altered the interrupt
rate to provide higher precision timers, and since about 1990,
most POSIX-inspired OSs on x86 platforms have provided access to
the full microsecond precision (via the BSD "gettimeofday" call).
Even Windows NT-derived systems have used a higher rate: since
at least NT 4 (I can't verify earlier systems), the OS has "ticked"
at a 100 HZ rate (or faster) and provided full access to a microsecond
timer (via the "Performance Counter").
Post by RichardIf you need millisecond, or actual hundredths, you may need to use some
other mechanism.
Yes. I have verified that both Tinycobol and OpenCobol (0.32) are
capable of providing access to the microsecond precision of the
system timer (of the some platform) via an external call (e.g.,
'CALL "gettimeofday" USING timeofday BY VALUE 0' in both dialects).
The OP doesn't mention which of the various AIX platforms he is
using, and I don't know enough about MicroFocus's product time to
guess, but I would imagine that some appropriate mechanism could
be jury-rigged whatever the platform. In addition, AIX is a
certified UNIX system, which means that it is required to provide
a clock precision of at least 50 ticks per second.
(Sorry if that's more information than you wanted to know.)
- dmw
--
. Douglas Wells . Connection Technologies .
. Internet: -sp9804- -at - contek.com- .