Reputation: 3
It was something like cMessage I think? I can't remember, could someone help me?
Upvotes: 0
Views: 281
Reputation:
cProfile ?
To time a function, you can also use a decorator like this one:
from functools import wraps
import time
def timed(f):
"""Time a function."""
@wraps(f)
def wrapper(*args, **kwds):
start = time.clock()
result = f(*args)
end = 1000 * (time.clock() - start)
print '%s: %.3f ms' % (f.func_name, end)
return result
return wrapper
And "mark" your fonction by "@timed" like that:
@timed
def toBeTimed():
pass
Upvotes: 2