Skip to content

Commit

Permalink
Add more logging info in the timing decorator
Browse files Browse the repository at this point in the history
  • Loading branch information
sb2nov committed Nov 6, 2015
1 parent 6608e27 commit 23a4cf0
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions dataduct/utils/decorators.py
@@ -1,20 +1,23 @@
"""Common decorator utilities
"""

import time
from datetime import datetime


def timeit(method):
"""Timing decorator for measuring performance of functions
"""

def timed(*args, **kw):
ts = time.time()
ts = datetime.now()
print 'Starting time for Method %r is %s' % (method.__name__, ts)

result = method(*args, **kw)
te = time.time()
te = datetime.now()
print 'End time for Method %r is %s' % (method.__name__, te)

print 'Method %r with arguments (%r, %r) took %2.2f secs' % \
(method.__name__, args, kw, te-ts)
(method.__name__, args, kw, (te-ts).total_seconds())
return result

return timed

0 comments on commit 23a4cf0

Please sign in to comment.