pathsim.utils.analysis module

class pathsim.utils.analysis.Timer(verbose=True)[source]

Bases: ContextDecorator

Context manager that times the execution time of the code inside of the context in ‘ms’ for debugging purposes.

Example

#time the code within the context
with Timer() as T:
    complicated_function()

#print the runtime in ms
print(T)
Parameters:

verbose (bool) – flag for verbose output

pathsim.utils.analysis.timer(func)[source]

Shows the execution time in milliseconds of the function object passed for debugging purposes

Parameters:

func (callable) – function to track execution time of

class pathsim.utils.analysis.Profiler(top_n=50, sort_by='cumulative')[source]

Bases: ContextDecorator

Context manager for easy code profiling

Example

#profile the code within the context
with Profiler():
    complicated_function()
Parameters:
  • top_n (int) – track top n function calls

  • sort_by (str) – method to sort function cally by