next up previous contents
Next: 5.14.7 A Note on Up: 5.14 Profiling Previous: 5.14.5 Profiling overhead

5.14.6 Additional Timing Utilities

[Macro]
time form

This macro evaluates form, prints some timing and memory allocation information to *trace-output*, and returns any values that form returns. The timing information includes real time, user run time, and system run time. This macro executes a form and reports the time and consing overhead. If the time form is not compiled (e.g. it was typed at top-level), then compile will be called on the form to give more accurate timing information. If you really want to time interpreted speed, you can say:

(time (eval 'form))
Things that execute fairly quickly should be timed more than once, since there may be more paging overhead in the first timing. To increase the accuracy of very short times, you can time multiple evaluations:
(time (dotimes (i 100) form))

[Function]
extensions:get-bytes-consed

This function returns the number of bytes allocated since the first time you called it. The first time it is called it returns zero. The above profiling routines use this to report consing information.

[Variable]
extensions:*gc-run-time*

This variable accumulates the run-time consumed by garbage collection, in the units returned by  get-internal-run-time.

[Constant]
internal-time-units-per-second
The value of internal-time-units-per-second is 100.



Raymond Toy
Mon Jul 14 09:11:27 EDT 1997