source: codes/mesh_generation/scvt/timer.py @ 1035

Last change on this file since 1035 was 974, checked in by dubos, 5 years ago

mesh_generation : creation

File size: 381 bytes
Line 
1import time
2
3############### profiling ##################
4
5class Timer(object):
6    def __init__(self, msg, verbose=True):
7        self.msg, self.verbose = msg, verbose
8    def __enter__(self):
9        self.tstart = time.time()
10    def __exit__(self, type, value, traceback):
11        if self.verbose:
12            print('Time spent %s : %s' % (self.msg, time.time() - self.tstart))
Note: See TracBrowser for help on using the repository browser.