2 #include "ace/OS_NS_sys_time.h"
3 #include "ace/OS_NS_sys_resource.h"
4 #include "ace/Global_Macros.h"
6 #if (defined (ACE_HAS_PRUSAGE_T) || defined (ACE_HAS_GETRUSAGE)) && !defined (ACE_WIN32)
8 # if defined (ACE_HAS_PRUSAGE_T)
9 # include "ace/OS_NS_stropts.h"
11 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
14 ACE_Profile_Timer::start (void)
16 ACE_TRACE ("ACE_Profile_Timer::start");
17 return ACE_OS::ioctl (this->proc_handle_,
23 ACE_Profile_Timer::stop (void)
25 ACE_TRACE ("ACE_Profile_Timer::stop");
26 this->last_usage_ = this->end_usage_;
27 return ACE_OS::ioctl (this->proc_handle_,
32 ACE_END_VERSIONED_NAMESPACE_DECL
34 # elif defined (ACE_HAS_GETRUSAGE)
36 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
39 ACE_Profile_Timer::start (void)
41 ACE_TRACE ("ACE_Profile_Timer::start");
42 this->begin_time_ = ACE_OS::gettimeofday ();
43 ACE_OS::getrusage (RUSAGE_SELF,
49 ACE_Profile_Timer::stop (void)
51 ACE_TRACE ("ACE_Profile_Timer::stop");
52 this->last_time_ = this->end_time_;
53 this->end_time_ = ACE_OS::gettimeofday ();
54 this->last_usage_ = this->end_usage_;
55 ACE_OS::getrusage (RUSAGE_SELF,
60 ACE_END_VERSIONED_NAMESPACE_DECL
62 # endif /* ACE_HAS_PRUSAGE_T */
64 #elif defined (ACE_WIN32)
66 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
69 ACE_Profile_Timer::~ACE_Profile_Timer (void)
74 ACE_Profile_Timer::start (void)
76 ACE_TRACE ("ACE_Profile_Timer::start");
77 # if defined (ACE_HAS_GETRUSAGE)
78 ACE_OS::getrusage (RUSAGE_SELF,
80 # endif /* ACE_HAS_GETRUSAGE */
81 this->timer_.start ();
86 ACE_Profile_Timer::stop (void)
88 ACE_TRACE ("ACE_Profile_Timer::stop");
90 # if defined (ACE_HAS_GETRUSAGE)
91 this->last_usage_ = this->end_usage_;
92 ACE_OS::getrusage (RUSAGE_SELF, &this->end_usage_);
93 # endif /* ACE_HAS_GETRUSAGE */
97 ACE_END_VERSIONED_NAMESPACE_DECL
101 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
104 ACE_Profile_Timer::start (void)
106 ACE_TRACE ("ACE_Profile_Timer::start");
107 this->timer_.start ();
112 ACE_Profile_Timer::stop (void)
114 ACE_TRACE ("ACE_Profile_Timer::stop");
115 this->timer_.stop ();
120 ACE_Profile_Timer::~ACE_Profile_Timer (void)
124 ACE_END_VERSIONED_NAMESPACE_DECL
126 #endif /* defined (ACE_HAS_PRUSAGE_T) || defined (ACE_HAS_GETRUSAGE) */