Public Member Functions | |
def | __init__ (self, moduleKey, bTrackEntries=False) |
def | add (self, data) |
def | complete (self, eventKeys) |
def | getEvents (self) |
def | getEntries (self) |
def | nEntries (self) |
def | nEvents (self) |
def | hasEmptyData (self) |
def | FormatStatsAsList (self, format_=None) |
def | FormatTimesAsList (self, format_={}) |
Public Member Functions inherited from SortModuleTimes.Stats | |
def | __init__ (self, bFloat=True) |
def | clear (self, bFloat=True) |
def | add (self, value, weight=1) |
def | n (self) |
def | weights (self) |
def | sum (self) |
def | min (self) |
def | max (self) |
def | sumsq (self) |
def | average (self) |
def | sqaverage (self) |
def | rms2 (self) |
def | rms (self) |
def | stdev (self) |
def | stdevp (self) |
Public Attributes | |
key | |
entries | |
Public Attributes inherited from SortModuleTimes.Stats | |
e_n | |
e_w | |
e_sum | |
e_sumsq | |
e_min | |
e_max | |
Collects statistics about execution time. This class collects statistics about execution time of a module or the whole event. The timing information is added by add() function, with as argument an instance of EntryDataClass. Optionally, the object can keep track of all the entries separately. The order of insertion of the events is also recorded. By default, this does not happen and only statistics are stored. The sample can be forcibly filled with empty entries. The idea is that one event is added to the sample only when the information about its timing is available. If we are tracking the event keys, we can check if we have all the events and, if some event keys are missing, we can add an empty entry for them so that we have the correct number of enrties in the sample. This is achieved by a call to complete(). Note that to keep the order of the events the correct one one should check if the previous event is present or not, and complete() with it, before adding a new event. If the completion is performed after the new event is added, the previous event will be added after the new one, when complete() is actually called.
Definition at line 196 of file SortModuleTimes.py.
def SortModuleTimes.TimeModuleStatsClass.__init__ | ( | self, | |
moduleKey, | |||
bTrackEntries = False |
|||
) |
Constructor: specifies the module we collect information about. If the flag bTrackEntries is true, all the added events are stored singly.
Definition at line 219 of file SortModuleTimes.py.
def SortModuleTimes.TimeModuleStatsClass.add | ( | self, | |
data | |||
) |
Adds a time to the sample. The argument data is an instance of EntryDataClass, that includes both event identification and timing information. Its time() is used as the value of the statistic; if the entry has no time (None), the event information is considered to be missing.
Definition at line 229 of file SortModuleTimes.py.
def SortModuleTimes.TimeModuleStatsClass.complete | ( | self, | |
eventKeys | |||
) |
Makes sure that an entry for each of the keys in eventKeys is present. For event keys already known, nothing happens. For new event keys, an empty entry is added at the end of the list, with no time information. Note that the events are added at the bottom of the list, in the relative order in eventKeys. If we are not tracking the events, nothing happens ever.
Definition at line 245 of file SortModuleTimes.py.
def SortModuleTimes.TimeModuleStatsClass.FormatStatsAsList | ( | self, | |
format_ = None |
|||
) |
Prints the collected information into a list. The list of strings includes a statistics ID (based on the key), an average time, a relative RMS in percent, the total time and the recorded the number of events with timing information and the timing extrema. The format dictionary can contain format directives, for future use (no format directive is currently supported).
Definition at line 291 of file SortModuleTimes.py.
def SortModuleTimes.TimeModuleStatsClass.FormatTimesAsList | ( | self, | |
format_ = {} |
|||
) |
Prints the collected information into a list. The list of strings includes a statistics ID (based on the key), and a time entry for each of the events stored (with holes for the events with missing time). The format dictionary can contain format directives; the ones supported so far are: - 'max_events' (int): limit the number of events to the first max_events (by default, all the available entries are printed) - 'format' (string, default: '%g'): the C-style formatting string for the numeric timings
Definition at line 315 of file SortModuleTimes.py.
def SortModuleTimes.TimeModuleStatsClass.getEntries | ( | self | ) |
Returns a list of the event statistics (if tracking the events).
Definition at line 268 of file SortModuleTimes.py.
def SortModuleTimes.TimeModuleStatsClass.getEvents | ( | self | ) |
Returns the list of known event keys (if tracking the events).
Definition at line 263 of file SortModuleTimes.py.
def SortModuleTimes.TimeModuleStatsClass.hasEmptyData | ( | self | ) |
Returns whethere there are entries without timing information. Note: throws if not tracking events.
Definition at line 283 of file SortModuleTimes.py.
def SortModuleTimes.TimeModuleStatsClass.nEntries | ( | self | ) |
Returns the number of recorded entries (throws if not tracking).
Definition at line 273 of file SortModuleTimes.py.
def SortModuleTimes.TimeModuleStatsClass.nEvents | ( | self | ) |
Returns the number of valid entries (events with timing).
Definition at line 278 of file SortModuleTimes.py.
SortModuleTimes.TimeModuleStatsClass.entries |
Definition at line 226 of file SortModuleTimes.py.
SortModuleTimes.TimeModuleStatsClass.key |
Definition at line 225 of file SortModuleTimes.py.