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_GETRUSAGE) && !defined (ACE_WIN32)
7 # if defined (ACE_HAS_GETRUSAGE)
9 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
12 ACE_Profile_Timer::start ()
14 ACE_TRACE ("ACE_Profile_Timer::start");
15 this->begin_time_ = ACE_OS::gettimeofday ();
16 ACE_OS::getrusage (RUSAGE_SELF,
22 ACE_Profile_Timer::stop ()
24 ACE_TRACE ("ACE_Profile_Timer::stop");
25 this->last_time_ = this->end_time_;
26 this->end_time_ = ACE_OS::gettimeofday ();
27 this->last_usage_ = this->end_usage_;
28 ACE_OS::getrusage (RUSAGE_SELF,
33 ACE_END_VERSIONED_NAMESPACE_DECL
35 # endif /* ACE_HAS_GETRUSAGE */
37 #elif defined (ACE_WIN32)
39 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
42 ACE_Profile_Timer::~ACE_Profile_Timer ()
47 ACE_Profile_Timer::start ()
49 ACE_TRACE ("ACE_Profile_Timer::start");
50 # if defined (ACE_HAS_GETRUSAGE)
51 ACE_OS::getrusage (RUSAGE_SELF,
53 # endif /* ACE_HAS_GETRUSAGE */
54 this->timer_.start ();
59 ACE_Profile_Timer::stop ()
61 ACE_TRACE ("ACE_Profile_Timer::stop");
63 # if defined (ACE_HAS_GETRUSAGE)
64 this->last_usage_ = this->end_usage_;
65 ACE_OS::getrusage (RUSAGE_SELF, &this->end_usage_);
66 # endif /* ACE_HAS_GETRUSAGE */
70 ACE_END_VERSIONED_NAMESPACE_DECL
74 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
77 ACE_Profile_Timer::start ()
79 ACE_TRACE ("ACE_Profile_Timer::start");
80 this->timer_.start ();
85 ACE_Profile_Timer::stop ()
87 ACE_TRACE ("ACE_Profile_Timer::stop");
93 ACE_Profile_Timer::~ACE_Profile_Timer ()
97 ACE_END_VERSIONED_NAMESPACE_DECL
99 #endif /* defined (ACE_HAS_GETRUSAGE) */