27 lines
651 B
Python
Executable File
27 lines
651 B
Python
Executable File
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()
|