summaryrefslogtreecommitdiff
path: root/ace
diff options
context:
space:
mode:
authorlevine <levine@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1998-03-13 22:33:05 +0000
committerlevine <levine@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1998-03-13 22:33:05 +0000
commit49801295f0e8d52390c2713b3c8c264dc714870c (patch)
treeeb127d4b5b519fb0d67713d00d3e523a27dfc3eb /ace
parent41ee4abd3a5c888abf9a4a86b1cc701fc23aa0e2 (diff)
downloadATCD-49801295f0e8d52390c2713b3c8c264dc714870c.tar.gz
added ACE_LACKS_FLOATING_POINT support
Diffstat (limited to 'ace')
-rw-r--r--ace/Profile_Timer.cpp8
-rw-r--r--ace/Profile_Timer.h67
-rw-r--r--ace/Profile_Timer.i40
-rw-r--r--ace/README1
-rw-r--r--ace/config-chorus.h1
5 files changed, 65 insertions, 52 deletions
diff --git a/ace/Profile_Timer.cpp b/ace/Profile_Timer.cpp
index 65f8d1fac4d..6e4b1df6f80 100644
--- a/ace/Profile_Timer.cpp
+++ b/ace/Profile_Timer.cpp
@@ -4,7 +4,7 @@
#include "ace/Profile_Timer.h"
#if !defined (__ACE_INLINE__)
-#include "ace/Profile_Timer.i"
+# include "ace/Profile_Timer.i"
#endif /* __ACE_INLINE__ */
ACE_ALLOC_HOOK_DEFINE(ACE_Profile_Timer)
@@ -244,7 +244,13 @@ ACE_Profile_Timer::elapsed_time (ACE_Elapsed_Time &et)
ACE_hrtime_t delta_t; /* nanoseconds */
timer_.elapsed_time (delta_t);
+#if defined (ACE_LACKS_FLOATING_POINT)
+ // If delta_t isn't large, then et.real_time will be 0. Sorry, no
+ // floating point.
+ et.real_time = delta_t / ACE_ONE_SECOND_IN_NSECS;
+#else /* ! ACE_LACKS_FLOATING_POINT */
et.real_time = delta_t / (double) ACE_ONE_SECOND_IN_NSECS;
+#endif /* ! ACE_LACKS_FLOATING_POINT */
et.user_time = 0;
et.system_time = 0;
diff --git a/ace/Profile_Timer.h b/ace/Profile_Timer.h
index 6776f629771..1dd1720f6af 100644
--- a/ace/Profile_Timer.h
+++ b/ace/Profile_Timer.h
@@ -1,18 +1,17 @@
/* -*- C++ -*- */
// $Id$
-
// ============================================================================
//
// = LIBRARY
// ace
-//
+//
// = FILENAME
// Profile_Timer.h
//
// = AUTHOR
-// Doug Schmidt
-//
+// Doug Schmidt
+//
// ============================================================================
#if !defined (ACE_PROFILE_TIMER_H)
@@ -22,30 +21,10 @@
#include "ace/Time_Value.h"
#include "ace/High_Res_Timer.h"
-#if !(defined (ACE_HAS_PRUSAGE_T) || defined (ACE_HAS_GETRUSAGE))
+#if defined (ACE_HAS_PRUSAGE_T) || defined (ACE_HAS_GETRUSAGE)
class ACE_Export ACE_Profile_Timer
{
-public:
- struct ACE_Elapsed_Time
- {
- double real_time;
- double user_time;
- double system_time;
- };
-
- ACE_Profile_Timer (void);
- ~ACE_Profile_Timer (void) {}
- int start (void);
- int stop (void);
- int elapsed_time (ACE_Elapsed_Time &et);
-
-private:
- ACE_High_Res_Timer timer_;
-};
-#else
-class ACE_Export ACE_Profile_Timer
-{
// = TITLE
// A C++ wrapper for UNIX interval timers.
public:
@@ -65,7 +44,7 @@ public:
// = Initialization and termination methods.
ACE_Profile_Timer (void);
// Default constructor.
-
+
~ACE_Profile_Timer (void);
// Shutdown the timer.
@@ -81,8 +60,8 @@ public:
// Compute the time elapsed since <start>.
void elapsed_rusage (ACE_Profile_Timer::Rusage &rusage);
- // Compute the amount of resource utilization since the start time.
-
+ // Compute the amount of resource utilization since the start time.
+
void get_rusage (ACE_Profile_Timer::Rusage &rusage);
// Return the resource utilization (don't recompute it).
@@ -137,10 +116,38 @@ private:
#endif /* ACE_HAS_PRUSAGE_T */
};
-#endif /* defined (ACE_HAS_PRUSAGE_T) || defined (ACE_HAS_GETRUSAGE) */
+#else /* ! ACE_HAS_PRUSAGE_T && ! ACE_HAS_GETRUSAGE */
+
+class ACE_Export ACE_Profile_Timer
+{
+public:
+ struct ACE_Elapsed_Time
+ {
+#if defined (ACE_LACKS_FLOATING_POINT)
+ ACE_UINT64 real_time;
+ ACE_UINT64 user_time;
+ ACE_UINT64 system_time;
+#else /* ! ACE_LACKS_FLOATING_POINT */
+ double real_time;
+ double user_time;
+ double system_time;
+#endif /* ! ACE_LACKS_FLOATING_POINT */
+ };
+
+ ACE_Profile_Timer (void);
+ ~ACE_Profile_Timer (void) {}
+ int start (void);
+ int stop (void);
+ int elapsed_time (ACE_Elapsed_Time &et);
+
+private:
+ ACE_High_Res_Timer timer_;
+};
+
+#endif /* ! ACE_HAS_PRUSAGE_T && ! ACE_HAS_GETRUSAGE */
#if defined (__ACE_INLINE__)
-#include "ace/Profile_Timer.i"
+# include "ace/Profile_Timer.i"
#endif /* __ACE_INLINE__ */
#endif /* ACE_PROFILE_TIMER_H */
diff --git a/ace/Profile_Timer.i b/ace/Profile_Timer.i
index 4d8ddc93dac..5571c9d7c9e 100644
--- a/ace/Profile_Timer.i
+++ b/ace/Profile_Timer.i
@@ -1,32 +1,30 @@
/* -*- C++ -*- */
// $Id$
-// Profile_Timer.i
-
#if defined (ACE_HAS_PRUSAGE_T) || defined (ACE_HAS_GETRUSAGE)
#if defined (ACE_HAS_PRUSAGE_T)
-ACE_INLINE int
-ACE_Profile_Timer::start (void)
+ACE_INLINE int
+ACE_Profile_Timer::start (void)
{
ACE_TRACE ("ACE_Profile_Timer::start");
- return ACE_OS::ioctl (this->proc_handle_,
- PIOCUSAGE,
- &this->begin_usage_);
+ return ACE_OS::ioctl (this->proc_handle_,
+ PIOCUSAGE,
+ &this->begin_usage_);
}
-ACE_INLINE int
-ACE_Profile_Timer::stop (void)
+ACE_INLINE int
+ACE_Profile_Timer::stop (void)
{
ACE_TRACE ("ACE_Profile_Timer::stop");
this->last_usage_ = this->end_usage_;
- return ACE_OS::ioctl (this->proc_handle_,
- PIOCUSAGE,
- &this->end_usage_);
+ return ACE_OS::ioctl (this->proc_handle_,
+ PIOCUSAGE,
+ &this->end_usage_);
}
-#elif defined (ACE_HAS_GETRUSAGE)
-ACE_INLINE int
-ACE_Profile_Timer::start (void)
+#elif defined (ACE_HAS_GETRUSAGE)
+ACE_INLINE int
+ACE_Profile_Timer::start (void)
{
ACE_TRACE ("ACE_Profile_Timer::start");
this->begin_time_ = ACE_OS::gettimeofday ();
@@ -34,8 +32,8 @@ ACE_Profile_Timer::start (void)
return 0;
}
-ACE_INLINE int
-ACE_Profile_Timer::stop (void)
+ACE_INLINE int
+ACE_Profile_Timer::stop (void)
{
ACE_TRACE ("ACE_Profile_Timer::stop");
this->last_time_ = this->end_time_;
@@ -49,16 +47,16 @@ ACE_Profile_Timer::stop (void)
#else
-ACE_INLINE int
-ACE_Profile_Timer::start (void)
+ACE_INLINE int
+ACE_Profile_Timer::start (void)
{
ACE_TRACE ("ACE_Profile_Timer::start");
timer_.start ();
return 0;
}
-ACE_INLINE int
-ACE_Profile_Timer::stop (void)
+ACE_INLINE int
+ACE_Profile_Timer::stop (void)
{
ACE_TRACE ("ACE_Profile_Timer::stop");
timer_.stop ();
diff --git a/ace/README b/ace/README
index 88f7fae0a06..fd20c4a960d 100644
--- a/ace/README
+++ b/ace/README
@@ -227,6 +227,7 @@ ACE_LACKS_COND_T Platform lacks condition variables (e.g., Win32 and VxWorks)
ACE_LACKS_CONDATTR_PSHARED Platform has no implementation of pthread_condattr_setpshared(), even though it supports pthreads!
ACE_LACKS_EXEC Platform lacks the exec() family of system calls (e.g., Win32, VxWorks, Chorus)
ACE_LACKS_FILELOCKS Platform lacks file locking mechanism
+ACE_LACKS_FLOATING_POINT Platform does not support floating point operations
ACE_LACKS_GETOPT_PROTO Platform lacks the getopt() prototype (e.g., LynxOS)
ACE_LACKS_GETPGID Platform lacks getpgid() call (e.g., Win32, Chorus, and FreeBSD).
ACE_LACKS_GETSERVBYNAME Platforms lacks getservbyname() (e.g., VxWorks and Chorus).
diff --git a/ace/config-chorus.h b/ace/config-chorus.h
index 0a979a01bbd..af0c68c0ede 100644
--- a/ace/config-chorus.h
+++ b/ace/config-chorus.h
@@ -29,6 +29,7 @@
# define ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA
# define ACE_HAS_TEMPLATE_SPECIALIZATION
# define ACE_LACKS_ACE_IOSTREAM /* MVME lacks signed and unsigned char */
+# define ACE_LACKS_FLOATING_POINT
#else /* ! __GNUG__ && ! ghs */
# error unsupported compiler on VxWorks
#endif /* ! __GNUG__ && ! ghs */