Merge branch 'master' into develop

This commit is contained in:
Andrew Morgan 2021-04-20 14:55:16 +01:00
commit 6982db9651
11 changed files with 62 additions and 40 deletions

View file

@ -104,7 +104,13 @@ class Measure:
"start",
]
def __init__(self, clock, name):
def __init__(self, clock, name: str):
"""
Args:
clock: A n object with a "time()" method, which returns the current
time in seconds.
name: The name of the metric to report.
"""
self.clock = clock
self.name = name
curr_context = current_context()
@ -117,10 +123,8 @@ class Measure:
else:
assert isinstance(curr_context, LoggingContext)
parent_context = curr_context
self._logging_context = LoggingContext(
"Measure[%s]" % (self.name,), parent_context
)
self.start = None
self._logging_context = LoggingContext(str(curr_context), parent_context)
self.start = None # type: Optional[int]
def __enter__(self) -> "Measure":
if self.start is not None: