From: Roy Turner

Subject: Timing Lisp functions within other functions?

Date: 1997-11-1 8:51


Hi folks,

We are running experiments on a constraint-based search algorithm where one of
the things we need to collect data about is run time without garbage
collection time.  Currently, we are doing two very kludgey things to do this:
   o capturing *trace-output*, using the "time" macro to gather times, then
     taking the returned string apart to get the time; the problem with this
     is that you can't trace anything without modifying the code to not use
     the time function, or to conditionally use the time function.  Since the
     code is pretty stable, this isn't too bad, but they solution is hideously
     inelegant -- there are obviously functions time is using to gather the
     times, so using the intermediate string is dumb.
   o using the undocumented function excl::get-internal-run-times in
     conjunction with the standard get-internal-run-time to get the GC time:
         (setq start (get-internal-run-time))
         (msetq (one two gc-start four)
           (excl::get-internal-run-times))
         (setq solution ,form)
         (setq end (get-internal-run-time))
         (msetq (one two gc-end four)
           (excl::get-internal-run-times))
         ;; compute the elapsed time - GC time...we think...
         (setq elapsed (- (- end start) (- gc-end gc-start)))
         (values 
          elapsed
          solution)
     The third return value *seems* to be the gc time, but...


Does anyone out there have a better way, or can anyone tell me what the return
values for excl::get-internal-run-times really are?  (I tried Franz, who
reaffirmed that the first was way one way of doing it; I asked for information
about this function, from them, too.)

Thanks a lot.
   --Roy
-------
Roy M. Turner, Assistant Professor () E-mail: <umcs.maine.edu at rmt>               
Department of Computer Science     () WWW:    http://cdps.umcs.maine.edu/~rmt  
5752 Neville Hall                  () Phone:  (207)581-3909                    
University of Maine                () FAX:    (207)581-4977                    
Orono, ME 04469-5752               () I use Lisp because I know C, C++, Ada,...