1 # Copyright (C) The Arvados Authors. All rights reserved.
3 # SPDX-License-Identifier: AGPL-3.0
5 from __future__ import print_function
6 from builtins import object
9 class CountTime(object):
10 def __init__(self, tag="", size=None):
15 self.start = time.time()
18 def __exit__(self, exc_type, exc_value, traceback):
19 sec = (time.time() - self.start)
22 th = "throughput %s/sec" % (self.size // sec)
23 print("%s time %s micoseconds %s" % (self.tag, sec*1000000, th))