| | |
- benchmark(run_group, n=5, alpha=0.050000000000000003, group_size=1)
- Returns the user CPU, system CPU, and real time confidence intervals
for n runs of the program to be benchmarked.
run_group should be an executable object that takes no arguments and
returns a tuple containing user CPU, system CPU, and real time, in
seconds. This tuple represents the total CPU usage of a group of
group_size iterations. You would use a group_size > 1 when the time
taken by a single iteration is too small to be measured.
See Miller, p. 271 for the formula for the standard deviation of a
group. The same applies to a confidence interval, since its size is
directly proportional to the standard deviation (as shown above).
CPU usage is returned in the form of two 95% confidence intervals in
(center, range) form; they are respectively user and system CPU
usage in seconds. I.e.:
((user_center, user_delta), \
(sys_center, sys_delta), \
(real_center, real_delta))
With (1-alpha) probability, the user CPU time is in the range
user_center +/- user_delta. Likewise for system CPU time and real time.
- run_program(program, args)
- Runs a program, returning a tuple of user CPU, system CPU, and real
time.
"program" is the name of the program; the last path component is
sufficient if it is in ENV['path'].
"args" is a sequence of arguments. It include the program name.
Raises an exception if the program returns non-zero.
|