#include <Clock.hh>
Public Member Functions | |
Clock (const std::string newName) | |
The Clock default constructor. | |
const std::string | getName () const |
Get the clock name. | |
virtual double | getResolution ()=0 |
Get the clock resolution in nano-seconds. | |
virtual uint64_t | getCurrentTicksValue ()=0 |
Get the current ticks value. | |
virtual uint64_t | getDeltaTicks (const uint64_t previousTicks) |
Get the delta between current ticks value and the one provided as argument. | |
virtual double | tick2NanoSecond (const uint64_t ticks)=0 |
Convert a number of ticks into a double value representing nanoseconds. | |
virtual double | getDeltaNanoSecond (const uint64_t firstTicks, const uint64_t secondTicks) |
Get delta between the provided ticks values in nano-seconds. | |
virtual double | getDeltaNanoSecond (const uint64_t previousTicks) |
Get delta between current ticks value and the one provided as argument as nano-second value. | |
virtual | ~Clock () |
Static Public Member Functions | |
static Clock * | getBestClock () |
Retrieve the best possible clock. | |
Protected Attributes | |
std::string | name |
Clock abstraction which tries to use high-resolution system clock in order to be able to help user to profile it's application using simple clock API. Derived class will use effective clock API like POSIX clock_xxxx functions: http://www.opengroup.org/onlinepubs/000095399/functions/clock_getres.html or other hardware assisted clock like Pentium TSC.
Definition at line 40 of file Clock.hh.
Clock | ( | const std::string | newName | ) |
The Clock default constructor.
[in] | newName | the clock name |
Definition at line 23 of file Clock.cc.
References Clock::name.
const std::string getName | ( | ) | const [inline] |
virtual double getResolution | ( | ) | [pure virtual] |
Get the clock resolution in nano-seconds.
Implemented in PosixClock, TSCClock, WinClock, and WinPerfClock.
virtual uint64_t getCurrentTicksValue | ( | ) | [pure virtual] |
Get the current ticks value.
Implemented in PosixClock, TSCClock, WinClock, and WinPerfClock.
Referenced by Clock::getDeltaTicks().
uint64_t getDeltaTicks | ( | const uint64_t | previousTicks | ) | [virtual] |
Get the delta between current ticks value and the one provided as argument.
[in] | previousTicks | a previous ticks value |
Definition at line 29 of file Clock.cc.
References Clock::getCurrentTicksValue().
Referenced by Clock::getDeltaNanoSecond().
virtual double tick2NanoSecond | ( | const uint64_t | ticks | ) | [pure virtual] |
Convert a number of ticks into a double value representing nanoseconds.
[in] | ticks | the number of tick to convert |
Implemented in PosixClock, TSCClock, WinClock, and WinPerfClock.
Referenced by Clock::getDeltaNanoSecond().
double getDeltaNanoSecond | ( | const uint64_t | firstTicks, | |
const uint64_t | secondTicks | |||
) | [virtual] |
Get delta between the provided ticks values in nano-seconds.
[in] | firstTicks | the first tick value |
[in] | secondTicks | the second (later) tick value |
Definition at line 33 of file Clock.cc.
References Clock::tick2NanoSecond().
double getDeltaNanoSecond | ( | const uint64_t | previousTicks | ) | [virtual] |
Get delta between current ticks value and the one provided as argument as nano-second value.
[in] | previousTicks |
Definition at line 38 of file Clock.cc.
References Clock::getDeltaTicks(), and Clock::tick2NanoSecond().
Clock * getBestClock | ( | ) | [static] |
Retrieve the best possible clock.
Definition at line 37 of file ClockFactory.cc.
std::string name [protected] |