summaryrefslogtreecommitdiff
path: root/ace/High_Res_Timer.i
diff options
context:
space:
mode:
authorlevine <levine@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1997-02-03 03:33:39 +0000
committerlevine <levine@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1997-02-03 03:33:39 +0000
commit2a9035255c70614ce70006bf7452463f4acd50a2 (patch)
treef9074b7777768bfd062940f73bc0b831829eac49 /ace/High_Res_Timer.i
parent034c1b8e866e6abd65c102900731d1ce9d38e7b2 (diff)
downloadATCD-2a9035255c70614ce70006bf7452463f4acd50a2.tar.gz
a bunch of changes, see ChangeLog-97a
Diffstat (limited to 'ace/High_Res_Timer.i')
-rw-r--r--ace/High_Res_Timer.i45
1 files changed, 30 insertions, 15 deletions
diff --git a/ace/High_Res_Timer.i b/ace/High_Res_Timer.i
index d54a40d52b3..0a2dd694429 100644
--- a/ace/High_Res_Timer.i
+++ b/ace/High_Res_Timer.i
@@ -3,8 +3,6 @@
// High_Res_Timer.i
-#if defined (ACE_HAS_HI_RES_TIMER) || defined (ACE_HAS_AIX_HI_RES_TIMER)
-
ACE_INLINE
ACE_High_Res_Timer::ACE_High_Res_Timer (void)
{
@@ -12,36 +10,55 @@ ACE_High_Res_Timer::ACE_High_Res_Timer (void)
this->reset ();
}
-ACE_INLINE void
+ACE_INLINE int
ACE_High_Res_Timer::start (void)
{
ACE_TRACE ("ACE_High_Res_Timer::start");
- this->start_ = ACE_OS::gethrtime ();
+ return (int) (this->start_ = ACE_OS::gethrtime ());
}
-ACE_INLINE void
+ACE_INLINE int
ACE_High_Res_Timer::stop (void)
{
ACE_TRACE ("ACE_High_Res_Timer::stop");
- this->end_ = ACE_OS::gethrtime ();
+ return (int) (this->end_ = ACE_OS::gethrtime ());
}
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 int
ACE_High_Res_Timer::start_incr (void)
{
ACE_TRACE ("ACE_High_Res_Timer::start_incr");
- this->temp_ = ACE_OS::gethrtime ();
+ return (int) (this->start_incr_ = ACE_OS::gethrtime ());
}
-ACE_INLINE void
+ACE_INLINE int
ACE_High_Res_Timer::stop_incr (void)
{
ACE_TRACE ("ACE_High_Res_Timer::stop_incr");
-#if defined (ACE_HAS_LONGLONG_T)
- this->total_ += (ACE_OS::gethrtime () - this->temp_);
-#else
-# error must have ACE_HAS_LONGLONG_T with ACE_High_Res_Timer
-#endif /* ACE_HAS_LONGLONG_T */
+ return (int) (this->total_ += (ACE_OS::gethrtime () - this->start_incr_));
+}
+
+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
@@ -49,5 +66,3 @@ ACE_High_Res_Timer::elapsed_microseconds (hrtime_t &usecs) const
{
usecs = (this->end_ - this->start_) / 1000;
}
-
-#endif /* ACE_HAS_HI_RES_TIMER || ACE_HAS_AIX_HI_RES_TIMER */