15 def rtime (fn, *args, **kw):
16 """Call FN with the additional arguments passed in.
17 Print a report of the CPU time taken.
19 ru0 = resource.getrusage (resource.RUSAGE_SELF)
22 ret = fn (*args, **kw)
24 ru1 = resource.getrusage (resource.RUSAGE_SELF)
25 print (
"utime: %f, stime: %f" % (ru1.ru_utime-ru0.ru_utime,
26 ru1.ru_stime-ru0.ru_stime))