Hi Chris,

that seems to be exactly what i need.

Cheers

Kim



 >>> import resource
 >>> def cpu_time():
... return resource.getrusage(resource.RUSAGE_SELF)[0]
...

Now try this out

 >>> def f():
... for i in xrange(100000):
... pass
...
 >>> start = cpu_time(); f(); dt = cpu_time() - start; print dt
0.008001
 >>> start = cpu_time(); f(); dt = cpu_time() - start; print dt
0.012001

On Feb 6, 2007, at 8:58 PM, Christopher Lucas wrote:

> python/python/545797?page=las

_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to