summaryrefslogtreecommitdiff
path: root/ACE/ace/High_Res_Timer.inl
diff options
context:
space:
mode:
authorJohnny Willemsen <jwillemsen@remedy.nl>2010-03-15 09:48:01 +0000
committerJohnny Willemsen <jwillemsen@remedy.nl>2010-03-15 09:48:01 +0000
commit7fd2d4b0a0a6162091e208090cdad552f11dda5d (patch)
tree2c1657eb8b73dd011c2130f8098423ed28a9607e /ACE/ace/High_Res_Timer.inl
parentf4ae2613c87ce239858f59a186003a1af9a51b71 (diff)
downloadATCD-7fd2d4b0a0a6162091e208090cdad552f11dda5d.tar.gz
Mon Mar 15 09:41:54 UTC 2010 Johnny Willemsen <jwillemsen@remedy.nl>
Reverted change below, it breaks unix builds Mon Mar 15 07:58:54 UTC 2010 Johnny Willemsen <jwillemsen@remedy.nl> * ace/High_Res_Timer.cpp * ace/High_Res_Timer.h * ace/High_Res_Timer.inl Use 64bit calculations to increase our precision. If you want to have the 32bit calculations, add ACE_USE_WINDOWS_32BIT_HIGH_RES_TIMER_CALCULATIONS as define. If the scoreboard doesn't show any platforms requiring 32bit, we will remove that code before the next micro release goes out Thanks to Alon Diamant <diamant dot alon at gmail dot com> for supplying the patches. This fixes bugzilla 3703.
Diffstat (limited to 'ACE/ace/High_Res_Timer.inl')
-rw-r--r--ACE/ace/High_Res_Timer.inl65
1 files changed, 13 insertions, 52 deletions
diff --git a/ACE/ace/High_Res_Timer.inl b/ACE/ace/High_Res_Timer.inl
index a568d971eda..56df6e1f04b 100644
--- a/ACE/ace/High_Res_Timer.inl
+++ b/ACE/ace/High_Res_Timer.inl
@@ -21,37 +21,21 @@ ACE_INLINE void
ACE_High_Res_Timer::hrtime_to_tv (ACE_Time_Value &tv,
const ACE_hrtime_t hrt)
{
-#if defined (ACE_USE_WINDOWS_32BIT_HIGH_RES_TIMER_CALCULATIONS)
-
- // The following are based on the units of global_scale_factor_
- // being 1/microsecond. Therefore, dividing by it converts
- // clock ticks to microseconds.
- tv.sec ((long) (hrt / (ACE_UINT32) ACE_HR_SCALE_CONVERSION /
+ // The following are based on the units of global_scale_factor_
+ // being 1/microsecond. Therefore, dividing by it converts
+ // clock ticks to microseconds.
+ tv.sec ((long) (hrt / (ACE_UINT32) ACE_HR_SCALE_CONVERSION /
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_
- // tv.usec = hrt / global_scale_factor_ - tv.sec * ACE_ONE_SECOND_IN_USECS
- // That first term will be lossy, so factor out global_scale_factor_:
- // 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_HR_SCALE_CONVERSION * global_scale_factor ());
- tv.usec ((long) ((hrt - tmp) / global_scale_factor ()));
-#else
-
- // This a higher-precision version, specific for Windows systems
- // The following are based on the units of global_scale_factor_
- // being 1/microsecond. Therefore, dividing by it converts
- // clock ticks to microseconds.
- tv.sec ((long) (hrt / global_scale_factor () ));
-
- // Calculate usec
- ACE_hrtime_t tmp = tv.sec ();
- tmp *= global_scale_factor ();
- tv.usec ((long) ((hrt - tmp) * ACE_HR_SCALE_CONVERSION / global_scale_factor ()));
-
-#endif
+ // 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_
+ // tv.usec = hrt / global_scale_factor_ - tv.sec * ACE_ONE_SECOND_IN_USECS
+ // That first term will be lossy, so factor out global_scale_factor_:
+ // 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_HR_SCALE_CONVERSION * global_scale_factor ());
+ tv.usec ((long) ((hrt - tmp) / global_scale_factor ()));
}
@@ -155,38 +139,15 @@ 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
{
-
-#if defined (ACE_USE_WINDOWS_32BIT_HIGH_RES_TIMER_CALCULATIONS)
-
ACE_hrtime_t elapsed = ACE_High_Res_Timer::elapsed_hrtime (this->end_,
this->start_);
usecs = (ACE_hrtime_t) (elapsed / global_scale_factor ());
-
-#else
-
- usecs = (ACE_High_Res_Timer::elapsed_hrtime (this->end_, this->start_) *
- ACE_HR_SCALE_CONVERSION) /
- global_scale_factor ();
-
-#endif
}
-#if defined (ACE_USE_WINDOWS_32BIT_HIGH_RES_TIMER_CALCULATIONS)
-
ACE_INLINE void
ACE_High_Res_Timer::global_scale_factor (ACE_UINT32 gsf)
{
global_scale_factor_ = gsf;
}
-#else
-
-ACE_INLINE void
-ACE_High_Res_Timer::global_scale_factor (ACE_UINT64 gsf)
-{
- global_scale_factor_ = gsf;
-}
-
-#endif
-
ACE_END_VERSIONED_NAMESPACE_DECL