summaryrefslogtreecommitdiff
path: root/ace/High_Res_Timer.h
diff options
context:
space:
mode:
authorharrison <harrison@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1997-02-27 23:14:47 +0000
committerharrison <harrison@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1997-02-27 23:14:47 +0000
commita65e54e9352696d7ff7cb431c20f65b26530fedb (patch)
treea3c483ad5e6fcff649b53434b822e06fe83a56ab /ace/High_Res_Timer.h
parent3770f10748b92224db710ec2b644a408b65f2cf1 (diff)
downloadATCD-a65e54e9352696d7ff7cb431c20f65b26530fedb.tar.gz
Added global_scale_factor to High_Res_Timer. Changed Profile_Timer to
use High_Res_Timer.
Diffstat (limited to 'ace/High_Res_Timer.h')
-rw-r--r--ace/High_Res_Timer.h22
1 files changed, 21 insertions, 1 deletions
diff --git a/ace/High_Res_Timer.h b/ace/High_Res_Timer.h
index fa940066ca7..a2a0cc3be47 100644
--- a/ace/High_Res_Timer.h
+++ b/ace/High_Res_Timer.h
@@ -51,8 +51,21 @@ public:
static int supported ();
// Returns 1 if high-resolution time is supported on the platform, 0 if not.
+ static void global_scale_factor (double gsf);
+ // <gsf> is used as a global scale factor. Any High_Res_Timers
+ // constructed with scale_factor == 0 will check and use <gsf> if
+ // set. This allows applications to set the scale factor just once
+ // for all High_Res_Timers. The scale factors passed to
+ // constructors take precedence to global_scale_factor_.
+
+ static ACE_Time_Value gettimeofday (void);
+ // Calls ACE_High_Res_Timer::hrtime_to_tv passing ACE_OS::gethrtime
+ // and global_scale_factor_. This function can be used to
+ // parameterize objects such as ACE_Timer_Queue::gettimeofday.
+
ACE_High_Res_Timer (double scale_factor = 0);
- // Initialize the timer.
+ // Initialize the timer. The <scale_factor> takes precedence to
+ // global_scale_factor_.
void reset (void);
// Reinitialize the timer.
@@ -102,6 +115,11 @@ public:
// Declare the dynamic allocation hooks.
private:
+ static void hrtime_to_tv (ACE_Time_Value &tv,
+ ACE_hrtime_t hrt,
+ double scale_factor);
+ // Converts an <hrt> to <tv> using the <scale_factor>.
+
ACE_hrtime_t start_;
// Starting time.
@@ -115,6 +133,8 @@ private:
// Start time of incremental timing.
double scale_factor_;
+
+ static double global_scale_factor_;
};
#if defined (__ACE_INLINE__)