diff options
author | levine <levine@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1997-02-05 19:01:26 +0000 |
---|---|---|
committer | levine <levine@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1997-02-05 19:01:26 +0000 |
commit | 72bd8ed9e6f7689a0e39f2e345c08170557972c6 (patch) | |
tree | 29850fc92f7e97d319dd1c9e9d0a4a24310c2459 /ace/High_Res_Timer.i | |
parent | 3205004ef7a87187309e8deb58940f9d3d76a46b (diff) | |
download | ATCD-72bd8ed9e6f7689a0e39f2e345c08170557972c6.tar.gz |
added optional scale factor
Diffstat (limited to 'ace/High_Res_Timer.i')
-rw-r--r-- | ace/High_Res_Timer.i | 32 |
1 files changed, 7 insertions, 25 deletions
diff --git a/ace/High_Res_Timer.i b/ace/High_Res_Timer.i index 68b5eb3dec8..9e043565643 100644 --- a/ace/High_Res_Timer.i +++ b/ace/High_Res_Timer.i @@ -10,7 +10,8 @@ ACE_High_Res_Timer::supported () } ACE_INLINE -ACE_High_Res_Timer::ACE_High_Res_Timer (void) +ACE_High_Res_Timer::ACE_High_Res_Timer (u_long scale_factor) + : scale_factor_ (scale_factor) { ACE_TRACE ("ACE_High_Res_Timer::ACE_High_Res_Timer"); this->reset (); @@ -31,22 +32,6 @@ ACE_High_Res_Timer::stop (void) } ACE_INLINE void -ACE_High_Res_Timer::elapsed_time (ACE_Time_Value &tv) -{ - tv.sec (this->end_ - this->start_ / 1000000L); - tv.usec (this->end_ - this->start_ % 1000000L); -} - -#if defined (ACE_HAS_POSIX_TIME) -ACE_INLINE void -ACE_High_Res_Timer::elapsed_time (timespec_t &elapsed_time) -{ - elapsed_time.tv_sec = (this->end_ - this->start_) / (1000 * 1000 * 1000); - elapsed_time.tv_nsec = (this->end_ - this->start_) % (1000 * 1000 * 1000); -} -#endif /* ACE_HAS_POSIX_TIME */ - -ACE_INLINE void ACE_High_Res_Timer::start_incr (void) { ACE_TRACE ("ACE_High_Res_Timer::start_incr"); @@ -61,14 +46,11 @@ ACE_High_Res_Timer::stop_incr (void) } ACE_INLINE void -ACE_High_Res_Timer::elapsed_time_incr (ACE_Time_Value &tv) -{ - tv.sec (this->total_ / 1000000L); - tv.usec (this->total_ % 1000000L); -} - -ACE_INLINE void ACE_High_Res_Timer::elapsed_microseconds (ACE_hrtime_t &usecs) const { - usecs = (this->end_ - this->start_) / 1000; + if (scale_factor_ > 0) { + usecs = (this->end_ - this->start_) / 1000L / scale_factor_; + } else { + usecs = (this->end_ - this->start_) / 1000L; + } } |