#include <Profile_Timer.h>
Collaboration diagram for ACE_Profile_Timer:

Public Types | |
| typedef ACE_Rusage | Rusage |
Public Member Functions | |
| ACE_Profile_Timer (void) | |
| Default constructor. Clears all time values to 0. | |
| ~ACE_Profile_Timer (void) | |
| Shutdown the timer. | |
| int | start (void) |
| Activate the timer. | |
| int | stop (void) |
| Stop the timer. | |
| int | elapsed_time (ACE_Elapsed_Time &et) |
Compute the time elapsed between calls to start() and stop(). | |
| void | elapsed_rusage (ACE_Profile_Timer::Rusage &rusage) |
| void | get_rusage (ACE_Profile_Timer::Rusage &rusage) |
| Return the resource utilization (don't recompute it). | |
| void | dump (void) const |
| Dump the state of an object. | |
Public Attributes | |
| ACE_ALLOC_HOOK_DECLARE | |
| Declare the dynamic allocation hooks. | |
Private Member Functions | |
| void | compute_times (ACE_Elapsed_Time &et) |
| Compute how much time has elapsed. | |
Private Attributes | |
| ACE_Profile_Timer::Rusage | begin_usage_ |
| Keep track of the starting resource utilization. | |
| ACE_Profile_Timer::Rusage | end_usage_ |
| Keep track of the ending resource utilization. | |
| ACE_Profile_Timer::Rusage | last_usage_ |
| Keep track of the last rusage for incremental timing. | |
| ACE_High_Res_Timer | timer_ |
| The high resolution timer. | |
Definition at line 34 of file Profile_Timer.h.
|
|
Definition at line 57 of file Profile_Timer.h. Referenced by elapsed_rusage(), and get_rusage(). |
|
|
Default constructor. Clears all time values to 0.
Definition at line 283 of file Profile_Timer.cpp. References ACE_TRACE, and ACE_OS::memset().
00284 : timer_ () 00285 { 00286 ACE_TRACE ("ACE_Profile_Timer::ACE_Profile_Timer"); 00287 # if defined (ACE_HAS_GETRUSAGE) 00288 00289 ACE_OS::memset (&this->end_usage_, 0, sizeof this->end_usage_); 00290 ACE_OS::memset (&this->begin_usage_, 0, sizeof this->begin_usage_); 00291 ACE_OS::memset (&this->last_usage_, 0, sizeof this->last_usage_); 00292 00293 ACE_OS::memset (&this->begin_time_, 0, sizeof this->begin_time_); 00294 ACE_OS::memset (&this->end_time_, 0, sizeof this->end_time_); 00295 ACE_OS::memset (&this->last_time_, 0, sizeof this->last_time_); 00296 # endif /* ACE_HAS_GETRUSAGE */ 00297 } |
|
|
Shutdown the timer.
Definition at line 72 of file Profile_Timer.inl.
00073 {
00074 }
|
|
|
Compute how much time has elapsed.
|
|
|
Dump the state of an object.
Definition at line 274 of file Profile_Timer.cpp. References ACE_TRACE, and ACE_High_Res_Timer::dump().
|
|
|
Compute the amount of resource utilization between calls to Definition at line 343 of file Profile_Timer.cpp. References ACE_TRACE, and Rusage.
00344 {
00345 ACE_TRACE ("ACE_Profile_Timer::elapsed_rusage");
00346
00347 # if defined (ACE_HAS_GETRUSAGE)
00348 // Use ACE_Time_Value's as intermediate because the type of ru_utime can
00349 // be multiple types and using the - operator is not safe when this are
00350 // 64bit FILETIMEs on Windows
00351 ACE_Time_Value end_ru_utime (this->end_usage_.ru_utime);
00352 ACE_Time_Value begin_ru_utime (this->begin_usage_.ru_utime);
00353 usage.ru_utime = end_ru_utime - begin_ru_utime;
00354
00355 ACE_Time_Value end_ru_stime (this->end_usage_.ru_stime);
00356 ACE_Time_Value begin_ru_stime (this->begin_usage_.ru_stime);
00357 usage.ru_stime = end_ru_stime - begin_ru_stime;
00358 # else /* ACE_HAS_GETRUSAGE */
00359 usage = 0;
00360 # endif /* ACE_HAS_GETRUSAGE */
00361 }
|
|
|
Compute the time elapsed between calls to
Definition at line 300 of file Profile_Timer.cpp. References ACE_hrtime_t, ACE_ONE_SECOND_IN_NSECS, ACE_ONE_SECOND_IN_USECS, ACE_Time_Value, ACE_TRACE, ACE_High_Res_Timer::elapsed_time(), ACE_Profile_Timer::ACE_Elapsed_Time::real_time, ACE_Time_Value::sec(), ACE_Profile_Timer::ACE_Elapsed_Time::system_time, ACE_Time_Value::usec(), and ACE_Profile_Timer::ACE_Elapsed_Time::user_time.
00301 {
00302 ACE_TRACE ("ACE_Profile_Timer::elapsed_time");
00303
00304 ACE_hrtime_t delta_t; // nanoseconds
00305 timer_.elapsed_time (delta_t);
00306 # if defined (ACE_LACKS_LONGLONG_T)
00307 et.real_time = delta_t / (double) ACE_ONE_SECOND_IN_NSECS;
00308 # else
00309 et.real_time = (__int64) delta_t / (double) ACE_ONE_SECOND_IN_NSECS;
00310 # endif /* ACE_LACKS_LONGLONG_T */
00311 # if defined (ACE_HAS_GETRUSAGE)
00312 ACE_Time_Value atv = ACE_Time_Value (this->end_usage_.ru_utime)
00313 - ACE_Time_Value (this->begin_usage_.ru_utime);
00314 et.user_time = atv.sec () + ((double) atv.usec ()) / ACE_ONE_SECOND_IN_USECS;
00315
00316 atv = ACE_Time_Value (this->end_usage_.ru_stime)
00317 - ACE_Time_Value (this->begin_usage_.ru_stime);
00318 et.system_time = atv.sec () + ((double) atv.usec ()) / ACE_ONE_SECOND_IN_USECS;
00319 # else /* ACE_HAS_GETRUSAGE */
00320 et.user_time = 0;
00321 et.system_time = 0;
00322 # endif /* ACE_HAS_GETRUSAGE */
00323
00324 return 0;
00325 }
|
|
|
Return the resource utilization (don't recompute it).
Definition at line 330 of file Profile_Timer.cpp. References ACE_TRACE, end_usage_, and Rusage.
00331 {
00332 ACE_TRACE ("ACE_Profile_Timer::get_rusage");
00333 # if defined (ACE_HAS_GETRUSAGE)
00334 usage = this->end_usage_;
00335 # else /* ACE_HAS_GETRUSAGE */
00336 usage = 0;
00337 # endif /* ACE_HAS_GETRUSAGE */
00338 }
|
|
|
Activate the timer.
Definition at line 77 of file Profile_Timer.inl. References ACE_TRACE, ACE_OS::getrusage(), RUSAGE_SELF, and ACE_High_Res_Timer::start().
00078 {
00079 ACE_TRACE ("ACE_Profile_Timer::start");
00080 # if defined (ACE_HAS_GETRUSAGE)
00081 ACE_OS::getrusage (RUSAGE_SELF,
00082 &this->begin_usage_);
00083 # endif /* ACE_HAS_GETRUSAGE */
00084 this->timer_.start ();
00085 return 0;
00086 }
|
|
|
Stop the timer.
Definition at line 89 of file Profile_Timer.inl. References ACE_TRACE, end_usage_, ACE_OS::getrusage(), last_usage_, RUSAGE_SELF, and ACE_High_Res_Timer::stop().
00090 {
00091 ACE_TRACE ("ACE_Profile_Timer::stop");
00092 this->timer_.stop ();
00093 # if defined (ACE_HAS_GETRUSAGE)
00094 this->last_usage_ = this->end_usage_;
00095 ACE_OS::getrusage (RUSAGE_SELF, &this->end_usage_);
00096 # endif /* ACE_HAS_GETRUSAGE */
00097 return 0;
00098 }
|
|
|
Declare the dynamic allocation hooks.
Definition at line 88 of file Profile_Timer.h. |
|
|
Keep track of the starting resource utilization.
Definition at line 95 of file Profile_Timer.h. |
|
|
Keep track of the ending resource utilization.
Definition at line 98 of file Profile_Timer.h. Referenced by get_rusage(), and stop(). |
|
|
Keep track of the last rusage for incremental timing.
Definition at line 101 of file Profile_Timer.h. Referenced by stop(). |
|
|
The high resolution timer.
Definition at line 128 of file Profile_Timer.h. |
1.3.6