[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Help Need: Time Function From: L66@psuvm.psu.edu

In article <9201151933.AA05483@phloem.uoregon.edu> cgay@phloem.uoregon.edu 
(Carl Gay) writes:
> have MCL in front of me to check this, but there is a function called
> get-internal-run-time (or maybe some variation on that theme) that
> will return an internal clock time in 60th of a second.  You can
> define your own function to return the time it takes to run a given
> function.  A simple example:
> (defun run-time-of (fun &rest args)
>  (let ((start (get-internal-run-time)))
>   (apply fun args)
>   (- (get-internal-run-time) start)))
> Of course I don't know if this includes time spent in the "cooperative
> multitasking experience" or not...

get-internal-run-time and get-internal-real-time are both standard Common 
Lisp functions.  In portable code, they should be used together with 
internal-time-units-per-second, a constant (which in MCL of course equals 

CLtL 1 is very unspecific about what the "run" version should do, but the 
idea is that the "real" version should return the real time (since some 
aribitrary timepoint, on the mac it is the startup time), while the "run" 
version ideally should return the time used by lisp ("cpu time") (but CLtL 
1 allows it to return real time as well...), that is, real time minus 
"time spent in the cooperative multitasking experience".  The MCL version 
of get-internal-run-time obviously works like this, but some of the Apple 
guys have to explain what exactly is included in this time.  I think it 
includes time spent in GC, for instance.

Espen J. Vestre,                          espen@coli.uni-sb.de
Universitaet des Saarlandes,        
Computerlinguistik, Gebaeude 17.2 
Im Stadtwald,
D-6600 SAARBRUECKEN, Germany           tel. +49 (681) 302 4501