Mercurial > pylearn
diff 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 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/mytime.py Thu Jul 03 17:52:11 2008 -0400 @@ -0,0 +1,12 @@ + +import time +#http://www.daniweb.com/code/snippet368.html +def print_timing(func): + def wrapper(*arg): + t1 = time.time() + res = func(*arg) + t2 = time.time() + print '%s took %0.3f ms' % (func.func_name, (t2-t1)*1000.0) + return res + return wrapper +