Measures how many machine cycles are needed to execute a proc.
p: the proc to be measured.
num-iterations: is the number of times to execute the proc.
reset-proc: if specified will be executed before each invocation of p after the first. The cost of the executation of the reset-proc is not included in the results.
Returns
The lowest cycle count obtained for any iteration.
Description
count-proc-cycles is only accurate to approximately +/- 4 cycles. Therefore, the results should not be trusted for small cycle counts.
The cycle count returned by
count-proc-cycles is highly processor dependent and is not comparable even between different processors of the same architecture (e.g. not even between two different Pentium 4 models).
The returned value is affected by other system activity (e.g. background tasks or other running programs). In addition it's accuracy is further reduced on multi-core or multi-processor systems or by the use of virtualization technology.
Also see
count-cycles.
Example
Example:
Measuring cost of proc using count-proc-cycles |
 |
{let array:Array = {Array}}
{count-proc-cycles
num-iterations = 50,
{proc {}:void
{array.append 1}
{array.append 2}
{array.append 3}
},
reset-proc = {proc {}:void {array.clear}}
}
| |