Changes to attempt to silence bcc64x
[ACE_TAO.git] / ACE / ace / Profile_Timer.inl
blobf4be327fac8778b105b84b607e24c4a7bfcf4e96
1 // -*- C++ -*-
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
11 ACE_INLINE int
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,
17                      &this->begin_usage_);
18   return 0;
21 ACE_INLINE int
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,
29                      &this->end_usage_);
30   return 0;
33 ACE_END_VERSIONED_NAMESPACE_DECL
35 #  endif /* ACE_HAS_GETRUSAGE */
37 #elif defined (ACE_WIN32)
39 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
41 ACE_INLINE
42 ACE_Profile_Timer::~ACE_Profile_Timer ()
46 ACE_INLINE int
47 ACE_Profile_Timer::start ()
49   ACE_TRACE ("ACE_Profile_Timer::start");
50 #  if defined (ACE_HAS_GETRUSAGE)
51   ACE_OS::getrusage (RUSAGE_SELF,
52                      &this->begin_usage_);
53 #  endif /* ACE_HAS_GETRUSAGE */
54   this->timer_.start ();
55   return 0;
58 ACE_INLINE int
59 ACE_Profile_Timer::stop ()
61   ACE_TRACE ("ACE_Profile_Timer::stop");
62   this->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 */
67   return 0;
70 ACE_END_VERSIONED_NAMESPACE_DECL
72 #else
74 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
76 ACE_INLINE int
77 ACE_Profile_Timer::start ()
79   ACE_TRACE ("ACE_Profile_Timer::start");
80   this->timer_.start ();
81   return 0;
84 ACE_INLINE int
85 ACE_Profile_Timer::stop ()
87   ACE_TRACE ("ACE_Profile_Timer::stop");
88   this->timer_.stop ();
89   return 0;
92 ACE_INLINE
93 ACE_Profile_Timer::~ACE_Profile_Timer ()
97 ACE_END_VERSIONED_NAMESPACE_DECL
99 #endif /* defined (ACE_HAS_GETRUSAGE) */