count
count( [s_function... |t] ) =>g_result/t
Description
Counts the number of times a function has been called. This is an nlambda function. Returns the functions marked for counting.
Measures function call frequency and also serves as a valuable debugging aid. Both count and uncount accept a list of functions, or t for counting/uncounting all functions. To examine the number of times a function has been counted, call the uncount function. A list containing the number of times each function was called, along with the function name, is returned in the form of a list of (number functionName) pairs, such as,
((20 plus) (10 times) (5 greaterp))
The sublists are sorted by their first elements, using sortcar, so the most frequently executed functions always appear at the head of the list.
Arguments
|
Turns on counting for the functions given, or for all functions if |
Value Returned
|
If no arguments are given and all functions are being counted. |
Examples
count( plus greaterp ) ; Counts plus and greaterp
setq( x plus( 2 3 )) ; Use the functions being counted.
uncount( plus greaterp )
=> ((1 plus) (0 greaterp)) ; Number of times each
; function was called.
Related Topics
Return to top