Renamed instances of Click to Tick for consistency.
This commit is contained in:
parent
1c3b2b2554
commit
18abc3aff7
@ -65,16 +65,16 @@ class SG_EXPORT Timer {
|
|||||||
inline Timer_t tick() const;
|
inline Timer_t tick() const;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
inline double delta_s( Timer_t t1, Timer_t t2 ) const { return (double)(t2 - t1)*_secsPerClick; }
|
inline double delta_s( Timer_t t1, Timer_t t2 ) const { return (double)(t2 - t1)*_secsPerTick; }
|
||||||
inline double delta_m( Timer_t t1, Timer_t t2 ) const { return delta_s(t1,t2)*1e3; }
|
inline double delta_m( Timer_t t1, Timer_t t2 ) const { return delta_s(t1,t2)*1e3; }
|
||||||
inline double delta_u( Timer_t t1, Timer_t t2 ) const { return delta_s(t1,t2)*1e6; }
|
inline double delta_u( Timer_t t1, Timer_t t2 ) const { return delta_s(t1,t2)*1e6; }
|
||||||
inline double delta_n( Timer_t t1, Timer_t t2 ) const { return delta_s(t1,t2)*1e9; }
|
inline double delta_n( Timer_t t1, Timer_t t2 ) const { return delta_s(t1,t2)*1e9; }
|
||||||
|
|
||||||
inline double getSecondsPerClick() const { return _secsPerClick; }
|
inline double getSecondsPerTick() const { return _secsPerTick; }
|
||||||
|
|
||||||
protected :
|
protected :
|
||||||
|
|
||||||
double _secsPerClick;
|
double _secsPerTick;
|
||||||
bool _useStandardClock;
|
bool _useStandardClock;
|
||||||
|
|
||||||
# ifdef __sgi
|
# ifdef __sgi
|
||||||
|
@ -43,7 +43,7 @@ const Timer* Timer::instance()
|
|||||||
|
|
||||||
if (_useStandardClock)
|
if (_useStandardClock)
|
||||||
{
|
{
|
||||||
_secsPerClick = (1.0 / (double) CLOCKS_PER_SEC);
|
_secsPerTick = (1.0 / (double) CLOCKS_PER_SEC);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -59,7 +59,7 @@ const Timer* Timer::instance()
|
|||||||
|
|
||||||
_tempSecsPerClick = 1.0/(double)(end_time-start_time);
|
_tempSecsPerClick = 1.0/(double)(end_time-start_time);
|
||||||
}
|
}
|
||||||
_secsPerClick = _tempSecsPerClick;
|
_secsPerTick = _tempSecsPerClick;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -77,7 +77,7 @@ const Timer* Timer::instance()
|
|||||||
|
|
||||||
if (_useStandardClock)
|
if (_useStandardClock)
|
||||||
{
|
{
|
||||||
_secsPerClick = 1e-6; // gettimeofday()'s precision.
|
_secsPerTick = 1e-6; // gettimeofday()'s precision.
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -92,7 +92,7 @@ const Timer* Timer::instance()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
_secsPerClick = 1.0/cpuspeed;
|
_secsPerTick = 1.0/cpuspeed;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -113,7 +113,7 @@ const Timer* Timer::instance()
|
|||||||
|
|
||||||
if (_useStandardClock)
|
if (_useStandardClock)
|
||||||
{
|
{
|
||||||
_secsPerClick = 1e-6; // gettimeofday()'s precision.
|
_secsPerTick = 1e-6; // gettimeofday()'s precision.
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -145,11 +145,11 @@ const Timer* Timer::instance()
|
|||||||
Timer_t start_time = tick();
|
Timer_t start_time = tick();
|
||||||
sleep (1);
|
sleep (1);
|
||||||
Timer_t end_time = tick();
|
Timer_t end_time = tick();
|
||||||
_secsPerClick = 1.0/(double)(end_time-start_time);
|
_secsPerTick = 1.0/(double)(end_time-start_time);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_secsPerClick = 1e-6/cpu_mhz;
|
_secsPerTick = 1e-6/cpu_mhz;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -210,7 +210,7 @@ const Timer* Timer::instance()
|
|||||||
_clockAddress_32 = (unsigned long *) iotimer_addr,
|
_clockAddress_32 = (unsigned long *) iotimer_addr,
|
||||||
_clockAddress_64 = 0;
|
_clockAddress_64 = 0;
|
||||||
|
|
||||||
_secsPerClick = (double)(cycleval)* 1e-12;
|
_secsPerTick = (double)(cycleval)* 1e-12;
|
||||||
|
|
||||||
#if 0 // Obsolete
|
#if 0 // Obsolete
|
||||||
// this is to force the use of the standard clock in
|
// this is to force the use of the standard clock in
|
||||||
@ -224,7 +224,7 @@ const Timer* Timer::instance()
|
|||||||
|
|
||||||
if (_useStandardClock)
|
if (_useStandardClock)
|
||||||
{
|
{
|
||||||
_secsPerClick = 1e-6; // gettimeofday()'s precision.
|
_secsPerTick = 1e-6; // gettimeofday()'s precision.
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -242,7 +242,7 @@ const Timer* Timer::instance()
|
|||||||
Timer::Timer( void )
|
Timer::Timer( void )
|
||||||
{
|
{
|
||||||
_useStandardClock = false;
|
_useStandardClock = false;
|
||||||
_secsPerClick = 1e-6; // Carbon timer's precision.
|
_secsPerTick = 1e-6; // Carbon timer's precision.
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -259,7 +259,7 @@ const Timer* Timer::instance()
|
|||||||
Timer::Timer( void )
|
Timer::Timer( void )
|
||||||
{
|
{
|
||||||
_useStandardClock = true;
|
_useStandardClock = true;
|
||||||
_secsPerClick = 1e-6; // gettimeofday()'s precision.
|
_secsPerTick = 1e-6; // gettimeofday()'s precision.
|
||||||
}
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
@ -269,7 +269,7 @@ const Timer* Timer::instance()
|
|||||||
Timer::Timer( void )
|
Timer::Timer( void )
|
||||||
{
|
{
|
||||||
_useStandardClock = true;
|
_useStandardClock = true;
|
||||||
_secsPerClick = (1.0 / (double) CLOCKS_PER_SEC);
|
_secsPerTick = (1.0 / (double) CLOCKS_PER_SEC);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user