[7297] Fixed profession spells sorting in trainer spell list at client.
[getmangos.git] / dep / ACE_wrappers / ace / Profile_Timer.inl
blob9990585cef646fcb6e12797d4e4542a0f2d5f09a
1 // -*- C++ -*-
2 //
3 // $Id: Profile_Timer.inl 80826 2008-03-04 14:51:23Z wotte $
5 #include "ace/OS_NS_sys_time.h"
6 #include "ace/OS_NS_sys_resource.h"
7 #include "ace/Global_Macros.h"
9 #if (defined (ACE_HAS_PRUSAGE_T) || defined (ACE_HAS_GETRUSAGE)) && !defined (ACE_WIN32)
11 #  if defined (ACE_HAS_PRUSAGE_T)
12 #    include "ace/OS_NS_stropts.h"
14 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
16 ACE_INLINE int
17 ACE_Profile_Timer::start (void)
19   ACE_TRACE ("ACE_Profile_Timer::start");
20   return ACE_OS::ioctl (this->proc_handle_,
21                         PIOCUSAGE,
22                         &this->begin_usage_);
25 ACE_INLINE int
26 ACE_Profile_Timer::stop (void)
28   ACE_TRACE ("ACE_Profile_Timer::stop");
29   this->last_usage_ = this->end_usage_;
30   return ACE_OS::ioctl (this->proc_handle_,
31                     PIOCUSAGE,
32                     &this->end_usage_);
35 ACE_END_VERSIONED_NAMESPACE_DECL
37 #  elif defined (ACE_HAS_GETRUSAGE)
39 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
41 ACE_INLINE int
42 ACE_Profile_Timer::start (void)
44   ACE_TRACE ("ACE_Profile_Timer::start");
45   this->begin_time_ = ACE_OS::gettimeofday ();
46   ACE_OS::getrusage (RUSAGE_SELF,
47                      &this->begin_usage_);
48   return 0;
51 ACE_INLINE int
52 ACE_Profile_Timer::stop (void)
54   ACE_TRACE ("ACE_Profile_Timer::stop");
55   this->last_time_ = this->end_time_;
56   this->end_time_ = ACE_OS::gettimeofday ();
57   this->last_usage_ = this->end_usage_;
58   ACE_OS::getrusage (RUSAGE_SELF,
59                      &this->end_usage_);
60   return 0;
63 ACE_END_VERSIONED_NAMESPACE_DECL
65 #  endif /* ACE_HAS_PRUSAGE_T */
67 #elif defined (ACE_WIN32)
69 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
71 ACE_INLINE
72 ACE_Profile_Timer::~ACE_Profile_Timer (void)
76 ACE_INLINE int
77 ACE_Profile_Timer::start (void)
79   ACE_TRACE ("ACE_Profile_Timer::start");
80 #  if defined (ACE_HAS_GETRUSAGE)
81   ACE_OS::getrusage (RUSAGE_SELF,
82                      &this->begin_usage_);
83 #  endif /* ACE_HAS_GETRUSAGE */
84   this->timer_.start ();
85   return 0;
88 ACE_INLINE int
89 ACE_Profile_Timer::stop (void)
91   ACE_TRACE ("ACE_Profile_Timer::stop");
92   this->timer_.stop ();
93 #  if defined (ACE_HAS_GETRUSAGE)
94   this->last_usage_ = this->end_usage_;
95   ACE_OS::getrusage (RUSAGE_SELF, &this->end_usage_);
96 #  endif /* ACE_HAS_GETRUSAGE */
97   return 0;
100 ACE_END_VERSIONED_NAMESPACE_DECL
102 #else
104 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
106 ACE_INLINE int
107 ACE_Profile_Timer::start (void)
109   ACE_TRACE ("ACE_Profile_Timer::start");
110   this->timer_.start ();
111   return 0;
114 ACE_INLINE int
115 ACE_Profile_Timer::stop (void)
117   ACE_TRACE ("ACE_Profile_Timer::stop");
118   this->timer_.stop ();
119   return 0;
122 ACE_INLINE
123 ACE_Profile_Timer::~ACE_Profile_Timer (void)
127 ACE_END_VERSIONED_NAMESPACE_DECL
129 #endif /* defined (ACE_HAS_PRUSAGE_T) || defined (ACE_HAS_GETRUSAGE) */