00001 /* -*- C++ -*- */ 00002 // $Id: Profile_Timer.i,v 1.1.1.2 2001/12/04 14:33:07 chad Exp $ 00003 00004 #if (defined (ACE_HAS_PRUSAGE_T) || defined (ACE_HAS_GETRUSAGE)) && !defined (ACE_WIN32) 00005 00006 # if defined (ACE_HAS_PRUSAGE_T) 00007 ACE_INLINE int 00008 ACE_Profile_Timer::start (void) 00009 { 00010 ACE_TRACE ("ACE_Profile_Timer::start"); 00011 return ACE_OS::ioctl (this->proc_handle_, 00012 PIOCUSAGE, 00013 &this->begin_usage_); 00014 } 00015 00016 ACE_INLINE int 00017 ACE_Profile_Timer::stop (void) 00018 { 00019 ACE_TRACE ("ACE_Profile_Timer::stop"); 00020 this->last_usage_ = this->end_usage_; 00021 return ACE_OS::ioctl (this->proc_handle_, 00022 PIOCUSAGE, 00023 &this->end_usage_); 00024 } 00025 # elif defined (ACE_HAS_GETRUSAGE) 00026 ACE_INLINE int 00027 ACE_Profile_Timer::start (void) 00028 { 00029 ACE_TRACE ("ACE_Profile_Timer::start"); 00030 this->begin_time_ = ACE_OS::gettimeofday (); 00031 ACE_OS::getrusage (RUSAGE_SELF, 00032 &this->begin_usage_); 00033 return 0; 00034 } 00035 00036 ACE_INLINE int 00037 ACE_Profile_Timer::stop (void) 00038 { 00039 ACE_TRACE ("ACE_Profile_Timer::stop"); 00040 this->last_time_ = this->end_time_; 00041 this->end_time_ = ACE_OS::gettimeofday (); 00042 this->last_usage_ = this->end_usage_; 00043 ACE_OS::getrusage (RUSAGE_SELF, 00044 &this->end_usage_); 00045 return 0; 00046 } 00047 00048 # endif /* ACE_HAS_PRUSAGE_T */ 00049 00050 #elif defined (ACE_WIN32) 00051 00052 ACE_INLINE 00053 ACE_Profile_Timer::~ACE_Profile_Timer (void) 00054 { 00055 } 00056 00057 ACE_INLINE int 00058 ACE_Profile_Timer::start (void) 00059 { 00060 ACE_TRACE ("ACE_Profile_Timer::start"); 00061 # if defined (ACE_HAS_GETRUSAGE) 00062 ACE_OS::getrusage (RUSAGE_SELF, 00063 &this->begin_usage_); 00064 # endif /* ACE_HAS_GETRUSAGE */ 00065 this->timer_.start (); 00066 return 0; 00067 } 00068 00069 ACE_INLINE int 00070 ACE_Profile_Timer::stop (void) 00071 { 00072 ACE_TRACE ("ACE_Profile_Timer::stop"); 00073 this->timer_.stop (); 00074 # if defined (ACE_HAS_GETRUSAGE) 00075 this->last_usage_ = this->end_usage_; 00076 ACE_OS::getrusage (RUSAGE_SELF, &this->end_usage_); 00077 # endif /* ACE_HAS_GETRUSAGE */ 00078 return 0; 00079 } 00080 00081 #else 00082 00083 ACE_INLINE int 00084 ACE_Profile_Timer::start (void) 00085 { 00086 ACE_TRACE ("ACE_Profile_Timer::start"); 00087 this->timer_.start (); 00088 return 0; 00089 } 00090 00091 ACE_INLINE int 00092 ACE_Profile_Timer::stop (void) 00093 { 00094 ACE_TRACE ("ACE_Profile_Timer::stop"); 00095 this->timer_.stop (); 00096 return 0; 00097 } 00098 00099 ACE_INLINE 00100 ACE_Profile_Timer::~ACE_Profile_Timer (void) 00101 { 00102 } 00103 00104 #endif /* defined (ACE_HAS_PRUSAGE_T) || defined (ACE_HAS_GETRUSAGE) */
1.2.14 written by Dimitri van Heesch,
© 1997-2002