#include <GenericEventHandler.hpp>
Static Public Member Functions | |
static void | Reset () |
static void | BeginEvent (unsigned event) throw (Exception) |
static void | EndEvent (unsigned event) |
static double | GetElapsedTime (unsigned event) |
static void | Report () |
static void | Headings () |
static void | Enable () |
static void | Disable () |
static bool | IsEnabled () |
Static Private Member Functions | |
static void | MilliSleep (unsigned milliseconds) |
static double | GetWallTime () |
static double | ConvertWallTimeToMilliseconds (double wallTime) |
static double | ConvertWallTimeToSeconds (double wallTime) |
static void | CheckVectorSizes () |
Static Private Attributes | |
static std::vector< double > | mWallTime |
static std::vector< bool > | mHasBegun |
static bool | mEnabled = true |
static bool | mInitialised = false |
static bool | mInUse = false |
Friends | |
class | TestGenericEventHandler |
class | TestCellBasedEventHandler |
class | TestHeartEventHandler |
Note: this class assume that, for any given concrete class, the last event represents the total time, and thus wraps all other events.
The methods in this class are not implemented separately as then they would not be inline, which could impact performance; we generally want timing routines to be very lightweight.
Definition at line 52 of file GenericEventHandler.hpp.
static void GenericEventHandler< NUM_EVENTS, CONCRETE >::MilliSleep | ( | unsigned | milliseconds | ) | [inline, static, private] |
Sleep for a specified number of milliseconds Used in testing Ought to be more portable than sleep() or usleep().
milliseconds | minimim number of milliseconds for which to sleep (ought to be a multiple of 10) |
Definition at line 72 of file GenericEventHandler.hpp.
static double GenericEventHandler< NUM_EVENTS, CONCRETE >::GetWallTime | ( | ) | [inline, static, private] |
Helper function - get the current wall clock time
Definition at line 83 of file GenericEventHandler.hpp.
Referenced by GenericEventHandler< 13, HeartEventHandler >::BeginEvent(), GenericEventHandler< 13, HeartEventHandler >::EndEvent(), and GenericEventHandler< 13, HeartEventHandler >::GetElapsedTime().
static double GenericEventHandler< NUM_EVENTS, CONCRETE >::ConvertWallTimeToMilliseconds | ( | double | wallTime | ) | [inline, static, private] |
Convert a wall clock time to milliseconds.
wallTime | the wall time |
Definition at line 93 of file GenericEventHandler.hpp.
Referenced by GenericEventHandler< 13, HeartEventHandler >::GetElapsedTime().
static double GenericEventHandler< NUM_EVENTS, CONCRETE >::ConvertWallTimeToSeconds | ( | double | wallTime | ) | [inline, static, private] |
Convert a wall clock time to seconds.
wallTime | the wall time |
Definition at line 103 of file GenericEventHandler.hpp.
Referenced by GenericEventHandler< 13, HeartEventHandler >::Report().
static void GenericEventHandler< NUM_EVENTS, CONCRETE >::CheckVectorSizes | ( | ) | [inline, static, private] |
Make sure the vectors are the right length.
Definition at line 109 of file GenericEventHandler.hpp.
Referenced by GenericEventHandler< 13, HeartEventHandler >::BeginEvent(), GenericEventHandler< 13, HeartEventHandler >::Disable(), GenericEventHandler< 13, HeartEventHandler >::Enable(), GenericEventHandler< 13, HeartEventHandler >::EndEvent(), GenericEventHandler< 13, HeartEventHandler >::GetElapsedTime(), GenericEventHandler< 13, HeartEventHandler >::Headings(), GenericEventHandler< 13, HeartEventHandler >::Report(), and GenericEventHandler< 13, HeartEventHandler >::Reset().
static void GenericEventHandler< NUM_EVENTS, CONCRETE >::Reset | ( | ) | [inline, static] |
Reset the event handler - set all event durations to zero.
Definition at line 124 of file GenericEventHandler.hpp.
Referenced by GenericEventHandler< 13, HeartEventHandler >::Report().
static void GenericEventHandler< NUM_EVENTS, CONCRETE >::BeginEvent | ( | unsigned | event | ) | throw (Exception) [inline, static] |
Record the start of an event.
event | the index of an event (this must be less than NUM_EVENTS) |
Definition at line 141 of file GenericEventHandler.hpp.
Referenced by GenericEventHandler< 13, HeartEventHandler >::BeginEvent().
static void GenericEventHandler< NUM_EVENTS, CONCRETE >::EndEvent | ( | unsigned | event | ) | [inline, static] |
Record the ending of an event.
event | the index of an event (this must be less than NUM_EVENTS) |
Definition at line 182 of file GenericEventHandler.hpp.
Referenced by GenericEventHandler< 13, HeartEventHandler >::Report().
static double GenericEventHandler< NUM_EVENTS, CONCRETE >::GetElapsedTime | ( | unsigned | event | ) | [inline, static] |
Get the time (in milliseconds) accounted so far to the given event.
Will automatically determine if the event is currently ongoing or not.
event | the index of an event (this must be less than NUM_EVENTS) |
Definition at line 213 of file GenericEventHandler.hpp.
static void GenericEventHandler< NUM_EVENTS, CONCRETE >::Report | ( | ) | [inline, static] |
Print a report on the timed events and reset the handler.
Assumes all events have ended.
If there is a collection of processes then the report will include an average and maximum over all CPUs.
Definition at line 241 of file GenericEventHandler.hpp.
static void GenericEventHandler< NUM_EVENTS, CONCRETE >::Headings | ( | ) | [inline, static] |
Output the headings for a report.
Definition at line 346 of file GenericEventHandler.hpp.
static void GenericEventHandler< NUM_EVENTS, CONCRETE >::Enable | ( | ) | [inline, static] |
Enable the event handler so that it will record event durations.
Definition at line 372 of file GenericEventHandler.hpp.
Referenced by GenericEventHandler< 13, HeartEventHandler >::Reset().
static void GenericEventHandler< NUM_EVENTS, CONCRETE >::Disable | ( | ) | [inline, static] |
Disable the event handler, so that event durations are no longer recorded.
Definition at line 379 of file GenericEventHandler.hpp.
Referenced by GenericEventHandler< 13, HeartEventHandler >::BeginEvent().
static bool GenericEventHandler< NUM_EVENTS, CONCRETE >::IsEnabled | ( | ) | [inline, static] |
Check whether the event handler is enabled.
Definition at line 386 of file GenericEventHandler.hpp.
std::vector< double > GenericEventHandler< NUM_EVENTS, CONCRETE >::mWallTime [inline, static, private] |
Wall time assigned to each event
Definition at line 59 of file GenericEventHandler.hpp.
Referenced by GenericEventHandler< 13, HeartEventHandler >::BeginEvent(), GenericEventHandler< 13, HeartEventHandler >::CheckVectorSizes(), GenericEventHandler< 13, HeartEventHandler >::EndEvent(), GenericEventHandler< 13, HeartEventHandler >::GetElapsedTime(), GenericEventHandler< 13, HeartEventHandler >::Report(), and GenericEventHandler< 13, HeartEventHandler >::Reset().
std::vector< bool > GenericEventHandler< NUM_EVENTS, CONCRETE >::mHasBegun [inline, static, private] |
Whether each event is in progress
Definition at line 60 of file GenericEventHandler.hpp.
Referenced by GenericEventHandler< 13, HeartEventHandler >::BeginEvent(), GenericEventHandler< 13, HeartEventHandler >::CheckVectorSizes(), GenericEventHandler< 13, HeartEventHandler >::EndEvent(), GenericEventHandler< 13, HeartEventHandler >::GetElapsedTime(), GenericEventHandler< 13, HeartEventHandler >::Report(), and GenericEventHandler< 13, HeartEventHandler >::Reset().
bool GenericEventHandler< NUM_EVENTS, CONCRETE >::mEnabled = true [inline, static, private] |
Whether the event handler is recording event times
Definition at line 61 of file GenericEventHandler.hpp.
Referenced by GenericEventHandler< 13, HeartEventHandler >::BeginEvent(), GenericEventHandler< 13, HeartEventHandler >::Disable(), GenericEventHandler< 13, HeartEventHandler >::Enable(), GenericEventHandler< 13, HeartEventHandler >::EndEvent(), GenericEventHandler< 13, HeartEventHandler >::GetElapsedTime(), GenericEventHandler< 13, HeartEventHandler >::IsEnabled(), and GenericEventHandler< 13, HeartEventHandler >::Report().
bool GenericEventHandler< NUM_EVENTS, CONCRETE >::mInitialised = false [inline, static, private] |
For internal use
Definition at line 62 of file GenericEventHandler.hpp.
Referenced by GenericEventHandler< 13, HeartEventHandler >::CheckVectorSizes().
bool GenericEventHandler< NUM_EVENTS, CONCRETE >::mInUse = false [inline, static, private] |
Determines if any of the event have begun
Definition at line 63 of file GenericEventHandler.hpp.
Referenced by GenericEventHandler< 13, HeartEventHandler >::BeginEvent(), GenericEventHandler< 13, HeartEventHandler >::Report(), and GenericEventHandler< 13, HeartEventHandler >::Reset().