[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Help Need: Time Function From: L66@psuvm.psu.edu Date: 15 Jan 92 01:55:25 GMT
- To: L66@psuvm.psu.edu
- Subject: Help Need: Time Function From: L66@psuvm.psu.edu Date: 15 Jan 92 01:55:25 GMT
- From: cgay@phloem.uoregon.edu (Carl Gay)
- Date: Wed, 15 Jan 92 11:33:17 PST
- Cc: info-mcl@cambridge.apple.com
- In-reply-to: L66@psuvm.psu.edu's message of 15 Jan 92 01:55:25 GMT <92014.205525L66@psuvm.psu.edu>
Hello! I am using time function in my program to check the running time. Since
I have to check several different subroutines, I need to save output of time fu
nction into one of variables. However, I can't put resulted time into any varia
bles. Does anybody know how to save time into variable? Any suggestion will be
highly appreciated. L66@psuvm.psu.edu Jae Lee
Wasn't there a song "If I could save time in a variable?" Nah...
Do you mean that you are using the TIME macro? If you mean that you
want to save the running times of several functions and then compare
them programmatically then TIME probably isn't what you want. I don't
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...
Hope this helps.
-Carl