Mercurial > pylearn
comparison common/mytime.py @ 363:9e84e8a20a75
Added to misc.file
author | Joseph Turian <turian@gmail.com> |
---|---|
date | Thu, 03 Jul 2008 17:52:11 -0400 |
parents | common/time.py@430c9e92cd23 |
children |
comparison
equal
deleted
inserted
replaced
360:0e3af3c53ac7 | 363:9e84e8a20a75 |
---|---|
1 | |
2 import time | |
3 #http://www.daniweb.com/code/snippet368.html | |
4 def print_timing(func): | |
5 def wrapper(*arg): | |
6 t1 = time.time() | |
7 res = func(*arg) | |
8 t2 = time.time() | |
9 print '%s took %0.3f ms' % (func.func_name, (t2-t1)*1000.0) | |
10 return res | |
11 return wrapper | |
12 |