Module:utils.timing

Utilities for timing code execution.

7 Functions

IPython.utils.timing.clocku()floatingpointnumber

Return theUSER CPU time in seconds since the start of the process.This is done via a call to resource.getrusage, so it avoids thewraparound problems in time.clock().

IPython.utils.timing.clocks()floatingpointnumber

Return theSYSTEM CPU time in seconds since the start of the process.This is done via a call to resource.getrusage, so it avoids thewraparound problems in time.clock().

IPython.utils.timing.clock()floatingpointnumber

Return theTOTAL USER+SYSTEM CPU time in seconds since the start ofthe process. This is done via a call to resource.getrusage, so itavoids the wraparound problems in time.clock().

IPython.utils.timing.clock2()

Similar to clock(), but return a tuple of user/system times.

IPython.utils.timing.timings_out(reps,func,*args,**kw)

Execute a function reps times, return a tuple with the elapsed totalCPU time in seconds, the time per call and the function’s output.

Under Unix, the return value is the sum of user+system time consumed bythe process, computed via the resource module. This prevents problemsrelated to the wraparound effect which the time.clock() function has.

Under Windows the return value is in wall clock seconds. See thedocumentation for the time module for more details.

IPython.utils.timing.timings(reps,func,*args,**kw)

Execute a function reps times, return a tuple with the elapsed total CPUtime in seconds and the time per call. These are just the first two valuesin timings_out().

IPython.utils.timing.timing(func,*args,**kw)t_total

Execute a function once, return the elapsed total CPU time inseconds. This is just the first value in timings_out().