Files

27 lines
651 B
Python
Raw Permalink Normal View History

from contextlib import contextmanager
class XICProfiler:
def reset(self):
print("xic_profiler.reset called")
def report(self):
print("xic_profiler.report called")
@contextmanager
def phase(self, name):
print(f"xic_profiler.phase({name}) started")
try:
yield
finally:
print(f"xic_profiler.phase({name}) ended")
@contextmanager
def span(self, name, meta=None):
print(f"xic_profiler.span({name}, {meta}) started")
try:
yield
finally:
print(f"xic_profiler.span({name}, {meta}) ended")
xic_profiler = XICProfiler()