Re: SWI Prolog: runtime in milliseconds
- From: Jan Wielemaker <jan@xxxxxxxxxxxxxxxxxxx>
- Date: 25 Jun 2007 12:05:45 GMT
On 2007-06-25, Michael Felderer <michael.felderer@xxxxxxxxxx> wrote:
Hi all,
is there a way to fetch the runtime in SWI Prolog in milliseconds. I
tried to use the statistics predicate with keys cputime, runtime,
system_time and real_time but they all return values in seconds which is
not fine-grained enough for my application (I want to compare an OCL
implementation in Prolog with a Java implementation)
thanks in advance,
Michael Felderer
statistics(runtime, X) is Quintus/SICStus/YAP and a few more compatible
and returns a list, whose first member is the user CPU in milliseconds
and the second is the user CPU time since the last call.
statistics(cputime, X) gives the time in seconds as a *float*.
The granularity is system dependent. That is (in my view) the good point
of returning a float. Seconds is the unit of time and IEEE doubles can
both deal with high granularity and long runtimes.
Underlying calls are GetProcessTimes() for Windows and times() for
POSIX systems. The method to get the times() granularity varies
between OSes. It is quite possible there are OSes for which it
reports wrong values. It tries sysconf(_SC_CLK_TCK) and the constant
HZ. See pl-os.c, CpuTime() for details.
What OS are you running?
Cheers --- Jan
.
- Follow-Ups:
- Re: SWI Prolog: runtime in milliseconds
- From: Michael Felderer
- Re: SWI Prolog: runtime in milliseconds
- References:
- SWI Prolog: runtime in milliseconds
- From: Michael Felderer
- SWI Prolog: runtime in milliseconds
- Prev by Date: SWI Prolog: runtime in milliseconds
- Next by Date: Re: SWI Prolog: runtime in milliseconds
- Previous by thread: SWI Prolog: runtime in milliseconds
- Next by thread: Re: SWI Prolog: runtime in milliseconds
- Index(es):
Relevant Pages
|
|