qimpy.profiler.StopWatch
- class StopWatch(name)
Bases:
object
Simple profiling utility for blocks of code / functions. To use, create a StopWatch associated with a name at the start of the code block or function being profiled, and call stop() at the end of that block. For timing entire functions, use decorator stopwatch instead for convenience. Use print_stats at the end of the run to log statistics of execution times of each named code block or function.
- Parameters:
name (str) –
- __init__(name)
Start profiling a block of code named name.
- Parameters:
name (str) –
Methods
Start profiling a block of code named name.
Print statistics of all timings measured using class StopWatch.
Stop this watch and collect statistics on it.
Attributes
name of code block
start time of current event
- classmethod print_stats()
Print statistics of all timings measured using class StopWatch.
- stop()
Stop this watch and collect statistics on it.
- name: str
name of code block
- t_start: float | Event
start time of current event