python source benchmark
seung-won hwang
shwang5 at students.uiuc.edu
Mon Oct 2 23:40:53 EDT 2000
Hello,
I'm trying to benchmark python source with clock() function, but
my code below returns negative value. I am not sure if my code is
wrong or clock() is not suitable for getting CPU time... Any comment
would help me a lot. Thanks.
My code:
scl=time.clock()
...
fcl=time.clock()
print "Execution Time: =", fcl-scl
Reference:
clock ()
Return the current CPU time as a floating point number expressed in
seconds. The precision, and in fact the very definition of the meaning of
``CPU time'', depends on that of the C function of the same name, but in
any case, this is the function to use for benchmarking Python or timing
algorithms
More information about the Python-list
mailing list