armi.utils.codeTiming module¶
Utilities related to profiling code.
-
armi.utils.codeTiming.timed(*args)[source]¶ Decorate functions to measure how long they take.
Examples
@timed # your timer will be called the module+method name def mymethod(stuff): do stuff @timed('call my timer this instead') def mymethod2(stuff) do even more stuff
-
armi.utils.codeTiming.getMasterTimer()[source]¶ Duplicate function to the MasterTimer.getMasterTimer method
Provided for convenience and developer preference of which to use
-
class
armi.utils.codeTiming.MasterTimer[source]¶ Bases:
object-
_instance= <armi.utils.codeTiming.MasterTimer object>¶
-
static
getTimer(event_name)[source]¶ Return a timer with no special action take
with timer: ...friendly!
-
static
startTimer(event_name)[source]¶ Return a timer with a start call, or a newly made started timer
with timer: ...unfriendly!
-
static
endTimer(event_name)[source]¶ Return a timer with a stop call, or a newly made unstarted timer
with timer: ...unfriendly!
-
static
report(inclusion_cutoff=0.1, total_time=False)[source]¶ Write a string report of the timers
- Parameters
See also
armi.utils.codeTiming._Timer.__str__()prints out the results for each individual line item
-
static
timeline(base_file_name, inclusion_cutoff=0.1, total_time=False)[source]¶ Produces a timeline graphic of the timers
- Parameters
base_file_name (str) – whatever the leading file path should be this method generates the same file extension for every image to add to the base
inclusion_cutoff (float, optional) – Will not show results that have less than this fraction of the total time.
total_time (bool, optional) – Use either the ratio of total time or time since last report for consideration against the cutoff
-
-
class
armi.utils.codeTiming._Timer(name, start)[source]¶ Bases:
objectCode timer to call at various points to measure performance
see MasterTimer.getTimer() for construction
-
_frozen= False¶
-
property
isActive¶
-
property
pauses¶
-
property
time¶ Total time value
-
property
timeSinceReport¶ The elapsed time since this timer was asked to report itself
-
property
times¶ List of time start and stop pairs, if active the current time is used as the last stop
-