19280: don't redundantly re-parse the file
[arvados.git] / sdk / cwl / arvados_cwl / perf.py
1 # Copyright (C) The Arvados Authors. All rights reserved.
2 #
3 # SPDX-License-Identifier: Apache-2.0
4
5 from builtins import object
6
7 import time
8 import uuid
9
10 class Perf(object):
11     def __init__(self, logger, name):
12         self.logger = logger
13         self.name = name
14
15     def __enter__(self):
16         self.time = time.time()
17         self.logger.debug("ENTER %s %s", self.name, self.time)
18
19     def __exit__(self, exc_type=None, exc_value=None, traceback=None):
20         now = time.time()
21         self.logger.debug("EXIT %s %s %s", self.name, now, now - self.time)