std-time


Synopsis

(std-time '<function>) ; prints needed time and space resources

Description

STD-TIME is the main testing function.

It prints information of used resources while executing the function.

It uses the value of a global string variable to count several statistics of the resource usage.

The main tested resources are elapsed time, needed memory and file IO.

All magic characters from the *TIMER-FORMAT-STRING* are parsed, then the timer is initialized, the function is executed and then all used resources that are specified in the *TIMER-FORMAT-STRING* are calculated and printed.

*TIMER-FORMAT-STRING* ; controls output of STD-TIME

The magic characters expanded at output are:

Time:
%E Elapsed time in [hours:]min:sec
%e Elapsed time in seconds
%m Elapsed time in milliseconds
Memory:
%G Number of new globals
%@ Symbollist of new globals, such as (A B C)
%N Number of new consed nodes
%x Output of (mem)
IO:
%O Number of file opens
%C Number of file closes
%w Number of bytes written
%r Number of bytes read
Command Info:
%F Function printed expression
%R Return value

Note:

Be sure to quote func, not to evaluate it at calling time!

Otherwise you would get 0.0 secs.

Examples

(std-time '(repeat 100000 (std-random nil)))
; to be continued...

Default Value

The value of *TIMER-FORMAT-STRING* defaults to
"\n%F \t: %m ms" if *DEBUG* is nil when STDDEBUG is loaded, or
"\n%F => %R\n: %m ms, %G new globals, %N new nodes" if *DEBUG* was non-nil.

Arguments

function: any valid lisp expression, but preferrably a quoted list which is executed as function. Otherwise the elapsed time will be 0 ms.

Return Value

Not defined yet. Most likely NIL. Maybe it will return the association list of the used resources too. The keys will have to be specified then.

Side Effects

This is a typical function only used for its side effect. It may also be used to test simple side-effects.

Module

(std-require 'STDDEBUG)

Defined in STDDEBUG