casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables
Functions
recipes.benchmark Namespace Reference

Functions

def benchmark

Detailed Description

Using tools with timeit seems to be a real pain, so this is a simpler
alternative, although likely a little less accurate.

Function Documentation

def recipes.benchmark.benchmark (   func,
  args,
  kwargs,
  nreps = 5,
  nperrep = 1 
)
Run func(*args, **kwargs) nreps times and report how much CPU time it took.

args: a tuple of the positional parameters to pass to func.  Remember that
      (single_item) doesn't cut it - use (single_item,) as in
      benchmark(listvis, (vis,), 7).  (When benchmarking interactive cases
      like that, just hit the keys when required.)

kwargs: a dictionary of keyword arguments to pass to func.

nreps: should be a small integer > 1 to combat random error from other
       processes on the system (you probably want the minimum time).

nperrep: integer >= 1 used to improve the timing precision on fast
         funcs, i.e. nperrep times will be added and then divided by nperrep.

Definition at line 8 of file benchmark.py.

References irc_cs_task_regression.max.