GenericEventHandler< NUM_EVENTS, CONCRETE > Class Template Reference

#include <GenericEventHandler.hpp>

Inheritance diagram for GenericEventHandler< NUM_EVENTS, CONCRETE >:

Inheritance graph
[legend]
Collaboration diagram for GenericEventHandler< NUM_EVENTS, CONCRETE >:

Collaboration graph
[legend]

List of all members.

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 double GetCpuTime ()
static double ConvertTicksToMilliseconds (double clockTicks)
static double ConvertTicksToSeconds (double clockTicks)
static void CheckVectorSizes ()

Static Private Attributes

static std::vector< double > mCpuTime
static std::vector< bool > mHasBegun
static bool mEnabled = true
static bool mInitialised = false
static bool mInUse = false

Friends

class TestGenericEventHandler


Detailed Description

template<unsigned NUM_EVENTS, class CONCRETE>
class GenericEventHandler< NUM_EVENTS, CONCRETE >

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 52 of file GenericEventHandler.hpp.


Member Function Documentation

template<unsigned NUM_EVENTS, class CONCRETE>
static double GenericEventHandler< NUM_EVENTS, CONCRETE >::GetCpuTime (  )  [inline, static, private]

template<unsigned NUM_EVENTS, class CONCRETE>
static double GenericEventHandler< NUM_EVENTS, CONCRETE >::ConvertTicksToMilliseconds ( double  clockTicks  )  [inline, static, private]

Convert a CPU clock tick count to milliseconds.

Parameters:
clockTicks the CPU clock tick

Definition at line 72 of file GenericEventHandler.hpp.

Referenced by GenericEventHandler< 9, CancerEventHandler >::GetElapsedTime().

template<unsigned NUM_EVENTS, class CONCRETE>
static double GenericEventHandler< NUM_EVENTS, CONCRETE >::ConvertTicksToSeconds ( double  clockTicks  )  [inline, static, private]

Convert a CPU clock tick count to seconds.

Parameters:
clockTicks the CPU clock tick

Definition at line 82 of file GenericEventHandler.hpp.

Referenced by GenericEventHandler< 9, CancerEventHandler >::Report().

template<unsigned NUM_EVENTS, class CONCRETE>
static void GenericEventHandler< NUM_EVENTS, CONCRETE >::CheckVectorSizes (  )  [inline, static, private]

template<unsigned NUM_EVENTS, class CONCRETE>
static void GenericEventHandler< NUM_EVENTS, CONCRETE >::Reset (  )  [inline, static]

Reset the event handler - set all event durations to zero.

Definition at line 103 of file GenericEventHandler.hpp.

Referenced by GenericEventHandler< 9, CancerEventHandler >::Report().

template<unsigned NUM_EVENTS, class CONCRETE>
static void GenericEventHandler< NUM_EVENTS, CONCRETE >::BeginEvent ( unsigned  event  )  throw (Exception) [inline, static]

Record the start of an event.

Parameters:
event the index of an event (this must be less than NUM_EVENTS)

Definition at line 120 of file GenericEventHandler.hpp.

Referenced by GenericEventHandler< 9, CancerEventHandler >::BeginEvent().

template<unsigned NUM_EVENTS, class CONCRETE>
static void GenericEventHandler< NUM_EVENTS, CONCRETE >::EndEvent ( unsigned  event  )  [inline, static]

Record the ending of an event.

Parameters:
event the index of an event (this must be less than NUM_EVENTS)

Definition at line 158 of file GenericEventHandler.hpp.

Referenced by GenericEventHandler< 9, CancerEventHandler >::Report().

template<unsigned NUM_EVENTS, class CONCRETE>
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.

Parameters:
event the index of an event (this must be less than NUM_EVENTS)

Definition at line 186 of file GenericEventHandler.hpp.

template<unsigned NUM_EVENTS, class CONCRETE>
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 214 of file GenericEventHandler.hpp.

template<unsigned NUM_EVENTS, class CONCRETE>
static void GenericEventHandler< NUM_EVENTS, CONCRETE >::Headings (  )  [inline, static]

Output the headings for a report.

Definition at line 319 of file GenericEventHandler.hpp.

template<unsigned NUM_EVENTS, class CONCRETE>
static void GenericEventHandler< NUM_EVENTS, CONCRETE >::Enable (  )  [inline, static]

Enable the event handler so that it will record event durations.

Definition at line 345 of file GenericEventHandler.hpp.

Referenced by GenericEventHandler< 9, CancerEventHandler >::Reset().

template<unsigned NUM_EVENTS, class CONCRETE>
static void GenericEventHandler< NUM_EVENTS, CONCRETE >::Disable (  )  [inline, static]

Disable the event handler, so that event durations are no longer recorded.

Definition at line 352 of file GenericEventHandler.hpp.

Referenced by GenericEventHandler< 9, CancerEventHandler >::BeginEvent().

template<unsigned NUM_EVENTS, class CONCRETE>
static bool GenericEventHandler< NUM_EVENTS, CONCRETE >::IsEnabled (  )  [inline, static]

Check whether the event handler is enabled.

Definition at line 359 of file GenericEventHandler.hpp.


Member Data Documentation

template<unsigned NUM_EVENTS, class CONCRETE>
std::vector< double > GenericEventHandler< NUM_EVENTS, CONCRETE >::mCpuTime [inline, static, private]

template<unsigned NUM_EVENTS, class CONCRETE>
std::vector< bool > GenericEventHandler< NUM_EVENTS, CONCRETE >::mHasBegun [inline, static, private]

template<unsigned NUM_EVENTS, class CONCRETE>
bool GenericEventHandler< NUM_EVENTS, CONCRETE >::mEnabled = true [inline, static, private]

template<unsigned NUM_EVENTS, class CONCRETE>
bool GenericEventHandler< NUM_EVENTS, CONCRETE >::mInitialised = false [inline, static, private]

For internal use

Definition at line 59 of file GenericEventHandler.hpp.

Referenced by GenericEventHandler< 9, CancerEventHandler >::CheckVectorSizes().

template<unsigned NUM_EVENTS, class CONCRETE>
bool GenericEventHandler< NUM_EVENTS, CONCRETE >::mInUse = false [inline, static, private]


The documentation for this class was generated from the following file:

Generated on Tue Aug 4 16:11:17 2009 for Chaste by  doxygen 1.5.5