Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import psutil
- from time import time
- def timed(fn):
- def decorated(*x):
- start = time()
- result = fn(*x)
- print "Executing %s took %d ms" % (fn.__name__, (time()-start)*1000)
- return result
- return decorated
- @timed
- def cpuload():
- load = psutil.cpu_percent()
- print "cpuload() returns %d" % load
- return load
- print "cpuload.__name__==" + cpuload.__name__
- print "CPU load is %d%%" % cpuload()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement