diff options
author | levine <levine@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1998-05-28 02:35:12 +0000 |
---|---|---|
committer | levine <levine@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1998-05-28 02:35:12 +0000 |
commit | 03816b79cbd155b76e486d5e8dfa5e8881cff067 (patch) | |
tree | 6a3e18f8f93bf108fce4a9ffc5ff54e134b3d9bb /ace/High_Res_Timer.i | |
parent | b8d24ff356cc83fb4762ca51eb73baf0ef3bd6be (diff) | |
download | ATCD-03816b79cbd155b76e486d5e8dfa5e8881cff067.tar.gz |
moved calibration from constructor to global_scale_factor () accessor
Diffstat (limited to 'ace/High_Res_Timer.i')
-rw-r--r-- | ace/High_Res_Timer.i | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/ace/High_Res_Timer.i b/ace/High_Res_Timer.i index 8883c189434..9b3515264c8 100644 --- a/ace/High_Res_Timer.i +++ b/ace/High_Res_Timer.i @@ -9,7 +9,7 @@ ACE_High_Res_Timer::hrtime_to_tv (ACE_Time_Value &tv, // being 1/microsecond. Therefore, dividing by it converts // clock ticks to microseconds. tv.sec ((long) (hrt / (ACE_UINT32) ACE_ONE_SECOND_IN_USECS / - global_scale_factor_)); + global_scale_factor ())); // Calculate usec in a manner that's compatible with ACE_U_LongLong. // hrt = (tv.sec * ACE_ONE_SECOND_IN_USECS + tv.usec) * global_scale_factor_ @@ -18,8 +18,8 @@ ACE_High_Res_Timer::hrtime_to_tv (ACE_Time_Value &tv, // tv.usec = (hrt - tv.sec * ACE_ONE_SECOND_IN_USECS * global_scale_factor_)/ // global_scale_factor ACE_hrtime_t tmp = tv.sec (); - tmp *= ((ACE_UINT32) ACE_ONE_SECOND_IN_USECS * global_scale_factor_); - tv.usec ((long) ((hrt - tmp) / global_scale_factor_)); + tmp *= ((ACE_UINT32) ACE_ONE_SECOND_IN_USECS * global_scale_factor ()); + tv.usec ((long) ((hrt - tmp) / global_scale_factor ())); } @@ -30,7 +30,7 @@ ACE_High_Res_Timer::gettimeofday (const ACE_OS::ACE_HRTimer_Op op) // If the global_scale_factor_ == 1 and we're on a WIN32 platform, // then a scale factor is needed by the platform gethrtime. Since // one has not been set, just return ACE_OS::gettimeofday. - if (ACE_High_Res_Timer::global_scale_factor_ == 1) + if (ACE_High_Res_Timer::global_scale_factor () == 1) return ACE_OS::gettimeofday (); #endif /* ACE_WIN32 */ @@ -48,7 +48,7 @@ ACE_High_Res_Timer::gettime (const ACE_OS::ACE_HRTimer_Op op) // If the global_scale_factor_ == 1 and we're on a WIN32 platform, // then a scale factor is needed by the platform gethrtime. Since // one has not been set, just return ACE_OS::gettimeofday. - if (ACE_High_Res_Timer::global_scale_factor_ == 1) + if (ACE_High_Res_Timer::global_scale_factor () == 1) { ACE_Time_Value tv = ACE_OS::gettimeofday (); // Return the time in microseconds because the global_scale_factor_ @@ -96,7 +96,8 @@ ACE_High_Res_Timer::stop_incr (const ACE_OS::ACE_HRTimer_Op op) ACE_INLINE void ACE_High_Res_Timer::elapsed_microseconds (ACE_hrtime_t &usecs) const { - usecs = (ACE_hrtime_t) ((this->end_ - this->start_) / global_scale_factor_); + usecs = + (ACE_hrtime_t) ((this->end_ - this->start_) / global_scale_factor ()); } ACE_INLINE void @@ -104,9 +105,3 @@ ACE_High_Res_Timer::global_scale_factor (ACE_UINT32 gsf) { global_scale_factor_ = gsf; } - -ACE_INLINE ACE_UINT32 -ACE_High_Res_Timer::global_scale_factor () -{ - return global_scale_factor_; -} |