metawards.utils.Profiler¶
-
class
metawards.utils.
Profiler
(name: str = None, parent=None)[source]¶ This is a simple profiling class that supports manual instrumenting of the code. It is used for sub-function profiling.
-
__init__
(name: str = None, parent=None)[source]¶ Initialize self. See help(type(self)) for accurate signature.
Methods
__init__
(name[, parent])Initialize self. child_total
()Return the sum of time spent in the child profilers is_null
()Return whether this is a null profiler name
()Return the name of this profiler start
(name)Start profiling the section called ‘name’. stop
()Stop profiling. total
()Return the amount of time that was recorded for this profiler in milliseconds (accurate to ~nanoseconds) -
start
(name: str)[source]¶ Start profiling the section called ‘name’. This returns the updated profiler, e.g.
p = Profiler()
p = p.start(“long_loop”)
# run some code
p = p.end()
print(p)
-