Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
>>> # Code to profile
Is equivalent to:
>>> s_profile = StatisticProfile()
>>> s_thread = StatisticThread(profiler=s_profile, single=False)
>>> with s_thread:
>>> # Code to profile
"""
return StatisticThread(
profiler=self, period=period, single=single, group=group,
name=name,
)
# BBB
StatisticalProfile = StatisticProfile
class StatisticThread(threading.Thread, ProfileRunnerBase):
"""
Usage in a nutshell:
with StatisticThread() as profiler_thread:
# do stuff
profiler_thread.profiler.print_stats()
"""
__slots__ = (
'_test',
'_start_time',
'clean_exit',
)
def __init__(self, profiler=None, period=.001, single=True, group=None, name=None):
"""
profiler (None or StatisticProfile instance)
Available on instances as the "profiler" read-only property.