Chaste Release::3.1
|
#include <GenericEventHandler.hpp>
Static Public Member Functions | |
static GenericEventHandler < NUM_EVENTS, CONCRETE > * | Instance () |
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 () |
Protected Member Functions | |
GenericEventHandler () | |
Private Member Functions | |
double | GetWallTime () |
double | ConvertWallTimeToMilliseconds (double wallTime) |
double | ConvertWallTimeToSeconds (double wallTime) |
void | ResetImpl () |
void | BeginEventImpl (unsigned event) throw (Exception) |
void | EndEventImpl (unsigned event) |
double | GetElapsedTimeImpl (unsigned event) |
void | ReportImpl () |
void | HeadingsImpl () |
void | EnableImpl () |
void | DisableImpl () |
bool | IsEnabledImpl () |
Static Private Member Functions | |
static void | MilliSleep (unsigned milliseconds) |
Private Attributes | |
std::vector< double > | mWallTime |
std::vector< bool > | mHasBegun |
bool | mEnabled |
bool | mInUse |
Friends | |
class | TestGenericEventHandler |
class | TestCellBasedEventHandler |
class | TestHeartEventHandler |
A generic base class providing the functionality for timing various events. Subclasses provide the event codes and names; see HeartEventHandler for an example.
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 58 of file GenericEventHandler.hpp.
GenericEventHandler< NUM_EVENTS, CONCRETE >::GenericEventHandler | ( | ) | [inline, protected] |
Default constructor.
Definition at line 211 of file GenericEventHandler.hpp.
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 138 of file GenericEventHandler.hpp.
Referenced by GenericEventHandler< 1, EventHandler >::BeginEventImpl().
void GenericEventHandler< NUM_EVENTS, CONCRETE >::BeginEventImpl | ( | unsigned | event | ) | throw (Exception) [inline, private] |
Record the start of an event.
event | the index of an event (this must be less than NUM_EVENTS) |
Definition at line 240 of file GenericEventHandler.hpp.
double GenericEventHandler< NUM_EVENTS, CONCRETE >::ConvertWallTimeToMilliseconds | ( | double | wallTime | ) | [inline, private] |
Convert a wall clock time to milliseconds.
wallTime | the wall time |
Definition at line 99 of file GenericEventHandler.hpp.
Referenced by GenericEventHandler< 1, EventHandler >::GetElapsedTimeImpl().
double GenericEventHandler< NUM_EVENTS, CONCRETE >::ConvertWallTimeToSeconds | ( | double | wallTime | ) | [inline, private] |
Convert a wall clock time to seconds.
wallTime | the wall time |
Definition at line 109 of file GenericEventHandler.hpp.
Referenced by GenericEventHandler< 1, EventHandler >::ReportImpl().
static void GenericEventHandler< NUM_EVENTS, CONCRETE >::Disable | ( | ) | [inline, static] |
Disable the event handler, so that event durations are no longer recorded.
Definition at line 195 of file GenericEventHandler.hpp.
Referenced by GenericEventHandler< 1, EventHandler >::BeginEventImpl().
void GenericEventHandler< NUM_EVENTS, CONCRETE >::DisableImpl | ( | ) | [inline, private] |
Disable the event handler, so that event durations are no longer recorded.
Definition at line 464 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 189 of file GenericEventHandler.hpp.
Referenced by GenericEventHandler< 1, EventHandler >::ResetImpl().
void GenericEventHandler< NUM_EVENTS, CONCRETE >::EnableImpl | ( | ) | [inline, private] |
Enable the event handler so that it will record event durations.
Definition at line 458 of file GenericEventHandler.hpp.
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 148 of file GenericEventHandler.hpp.
Referenced by GenericEventHandler< 1, EventHandler >::ReportImpl().
void GenericEventHandler< NUM_EVENTS, CONCRETE >::EndEventImpl | ( | unsigned | event | ) | [inline, private] |
Record the ending of an event.
event | the index of an event (this must be less than NUM_EVENTS) |
Definition at line 280 of file GenericEventHandler.hpp.
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 160 of file GenericEventHandler.hpp.
double GenericEventHandler< NUM_EVENTS, CONCRETE >::GetElapsedTimeImpl | ( | unsigned | event | ) | [inline, private] |
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 310 of file GenericEventHandler.hpp.
double GenericEventHandler< NUM_EVENTS, CONCRETE >::GetWallTime | ( | ) | [inline, private] |
Helper function - get the current wall clock time.
Definition at line 89 of file GenericEventHandler.hpp.
Referenced by GenericEventHandler< 1, EventHandler >::BeginEventImpl(), GenericEventHandler< 1, EventHandler >::EndEventImpl(), and GenericEventHandler< 1, EventHandler >::GetElapsedTimeImpl().
static void GenericEventHandler< NUM_EVENTS, CONCRETE >::Headings | ( | ) | [inline, static] |
Output the headings for a report.
Definition at line 181 of file GenericEventHandler.hpp.
void GenericEventHandler< NUM_EVENTS, CONCRETE >::HeadingsImpl | ( | ) | [inline, private] |
Output the headings for a report.
Definition at line 435 of file GenericEventHandler.hpp.
static GenericEventHandler<NUM_EVENTS, CONCRETE>* GenericEventHandler< NUM_EVENTS, CONCRETE >::Instance | ( | ) | [inline, static] |
Get the singleton instance of the event handler.
Definition at line 119 of file GenericEventHandler.hpp.
Referenced by GenericEventHandler< 1, EventHandler >::BeginEvent(), GenericEventHandler< 1, EventHandler >::Disable(), GenericEventHandler< 1, EventHandler >::Enable(), GenericEventHandler< 1, EventHandler >::EndEvent(), GenericEventHandler< 1, EventHandler >::GetElapsedTime(), GenericEventHandler< 1, EventHandler >::Headings(), GenericEventHandler< 1, EventHandler >::IsEnabled(), GenericEventHandler< 1, EventHandler >::Report(), and GenericEventHandler< 1, EventHandler >::Reset().
static bool GenericEventHandler< NUM_EVENTS, CONCRETE >::IsEnabled | ( | ) | [inline, static] |
Check whether the event handler is enabled.
Definition at line 201 of file GenericEventHandler.hpp.
bool GenericEventHandler< NUM_EVENTS, CONCRETE >::IsEnabledImpl | ( | ) | [inline, private] |
Check whether the event handler is enabled.
Definition at line 470 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 78 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 173 of file GenericEventHandler.hpp.
void GenericEventHandler< NUM_EVENTS, CONCRETE >::ReportImpl | ( | ) | [inline, private] |
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 337 of file GenericEventHandler.hpp.
static void GenericEventHandler< NUM_EVENTS, CONCRETE >::Reset | ( | ) | [inline, static] |
Reset the event handler - set all event durations to zero.
Definition at line 128 of file GenericEventHandler.hpp.
Referenced by GenericEventHandler< 1, EventHandler >::ReportImpl().
void GenericEventHandler< NUM_EVENTS, CONCRETE >::ResetImpl | ( | ) | [inline, private] |
Reset the event handler - set all event durations to zero.
Definition at line 224 of file GenericEventHandler.hpp.
bool GenericEventHandler< NUM_EVENTS, CONCRETE >::mEnabled [private] |
Whether the event handler is recording event times
Definition at line 68 of file GenericEventHandler.hpp.
Referenced by GenericEventHandler< 1, EventHandler >::BeginEventImpl(), GenericEventHandler< 1, EventHandler >::DisableImpl(), GenericEventHandler< 1, EventHandler >::EnableImpl(), GenericEventHandler< 1, EventHandler >::EndEventImpl(), GenericEventHandler< 1, EventHandler >::GenericEventHandler(), GenericEventHandler< 1, EventHandler >::GetElapsedTimeImpl(), GenericEventHandler< 1, EventHandler >::IsEnabledImpl(), and GenericEventHandler< 1, EventHandler >::ReportImpl().
std::vector<bool> GenericEventHandler< NUM_EVENTS, CONCRETE >::mHasBegun [private] |
Whether each event is in progress
Definition at line 67 of file GenericEventHandler.hpp.
Referenced by GenericEventHandler< 1, EventHandler >::BeginEventImpl(), GenericEventHandler< 1, EventHandler >::EndEventImpl(), GenericEventHandler< 1, EventHandler >::GenericEventHandler(), GenericEventHandler< 1, EventHandler >::GetElapsedTimeImpl(), GenericEventHandler< 1, EventHandler >::ReportImpl(), and GenericEventHandler< 1, EventHandler >::ResetImpl().
bool GenericEventHandler< NUM_EVENTS, CONCRETE >::mInUse [private] |
Determines if any of the event have begun
Definition at line 69 of file GenericEventHandler.hpp.
Referenced by GenericEventHandler< 1, EventHandler >::BeginEventImpl(), GenericEventHandler< 1, EventHandler >::GenericEventHandler(), GenericEventHandler< 1, EventHandler >::ReportImpl(), and GenericEventHandler< 1, EventHandler >::ResetImpl().
std::vector<double> GenericEventHandler< NUM_EVENTS, CONCRETE >::mWallTime [private] |
Wall time assigned to each event
Definition at line 66 of file GenericEventHandler.hpp.
Referenced by GenericEventHandler< 1, EventHandler >::BeginEventImpl(), GenericEventHandler< 1, EventHandler >::EndEventImpl(), GenericEventHandler< 1, EventHandler >::GenericEventHandler(), GenericEventHandler< 1, EventHandler >::GetElapsedTimeImpl(), GenericEventHandler< 1, EventHandler >::ReportImpl(), and GenericEventHandler< 1, EventHandler >::ResetImpl().