Merge branch 'origin-2035-arv-mount-tags-folders'
[arvados.git] / sdk / python / arvados / timer.py
1 import time
2
3 class Timer(object):
4     def __init__(self, verbose=False):
5         self.verbose = verbose
6
7     def __enter__(self):
8         self.start = time.time()
9         return self
10
11     def __exit__(self, *args):
12         self.end = time.time()
13         self.secs = self.end - self.start
14         self.msecs = self.secs * 1000  # millisecs
15         if self.verbose:
16             print 'elapsed time: %f ms' % self.msecs