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

Public Types | |
| typedef ACE_Rusage | Rusage |
Public Methods | |
| ACE_Profile_Timer (void) | |
| Default constructor. Clears all time values to 0. More... | |
| ~ACE_Profile_Timer (void) | |
| Shutdown the timer. More... | |
| int | start (void) |
| Activate the timer. More... | |
| int | stop (void) |
| Stop the timer. More... | |
| int | elapsed_time (ACE_Elapsed_Time &et) |
Compute the time elapsed between calls to start() and stop(). More... | |
| void | elapsed_rusage (ACE_Profile_Timer::Rusage &rusage) |
Compute the amount of resource utilization between calls to start() and stop(). More... | |
| void | get_rusage (ACE_Profile_Timer::Rusage &rusage) |
| Return the resource utilization (don't recompute it). More... | |
| void | dump (void) const |
| Dump the state of an object. More... | |
Public Attributes | |
| ACE_ALLOC_HOOK_DECLARE | |
| Declare the dynamic allocation hooks. More... | |
Private Methods | |
| void | compute_times (ACE_Elapsed_Time &et) |
| Compute how much time has elapsed. More... | |
Private Attributes | |
| ACE_Profile_Timer::Rusage | begin_usage_ |
| Keep track of the starting resource utilization. More... | |
| ACE_Profile_Timer::Rusage | end_usage_ |
| Keep track of the ending resource utilization. More... | |
| ACE_Profile_Timer::Rusage | last_usage_ |
| Keep track of the last rusage for incremental timing. More... | |
| ACE_High_Res_Timer | timer_ |
| The high resolution timer. More... | |
Definition at line 33 of file Profile_Timer.h.
|
|
Definition at line 59 of file Profile_Timer.h. Referenced by elapsed_rusage, and get_rusage. |
|
|
Default constructor. Clears all time values to 0.
Definition at line 269 of file Profile_Timer.cpp. References ACE_TRACE, and ACE_OS_String::memset.
00270 : timer_ () 00271 { 00272 ACE_TRACE ("ACE_Profile_Timer::ACE_Profile_Timer"); 00273 # if defined (ACE_HAS_GETRUSAGE) 00274 00275 ACE_OS::memset (&this->end_usage_, 0, sizeof this->end_usage_); 00276 ACE_OS::memset (&this->begin_usage_, 0, sizeof this->begin_usage_); 00277 ACE_OS::memset (&this->last_usage_, 0, sizeof this->last_usage_); 00278 00279 ACE_OS::memset (&this->begin_time_, 0, sizeof this->begin_time_); 00280 ACE_OS::memset (&this->end_time_, 0, sizeof this->end_time_); 00281 ACE_OS::memset (&this->last_time_, 0, sizeof this->last_time_); 00282 # endif /* ACE_HAS_GETRUSAGE */ 00283 } |
|
|
Shutdown the timer.
Definition at line 100 of file Profile_Timer.i.
00101 {
00102 }
|
|
|
Compute how much time has elapsed.
|
|
|
Dump the state of an object.
Definition at line 262 of file Profile_Timer.cpp. References ACE_TRACE, ACE_High_Res_Timer::dump, and timer_.
|
|
|
Compute the amount of resource utilization between calls to
Definition at line 329 of file Profile_Timer.cpp. References ACE_TRACE, begin_usage_, end_usage_, and Rusage.
00330 {
00331 ACE_TRACE ("ACE_Profile_Timer::elapsed_rusage");
00332
00333 # if defined (ACE_HAS_GETRUSAGE)
00334 usage.ru_utime =
00335 this->end_usage_.ru_utime - this->begin_usage_.ru_utime;
00336 usage.ru_stime =
00337 this->end_usage_.ru_stime - this->begin_usage_.ru_stime;
00338 # else /* ACE_HAS_GETRUSAGE */
00339 usage = 0;
00340 # endif /* ACE_HAS_GETRUSAGE */
00341 }
|
|
|
Compute the time elapsed between calls to
Definition at line 286 of file Profile_Timer.cpp. References ACE_hrtime_t, ACE_ONE_SECOND_IN_NSECS, ACE_ONE_SECOND_IN_USECS, ACE_TRACE, ACE_High_Res_Timer::elapsed_time, ACE_Time_Value::sec, timer_, and ACE_Time_Value::usec.
00287 {
00288 ACE_TRACE ("ACE_Profile_Timer::elapsed_time");
00289
00290 ACE_hrtime_t delta_t; // nanoseconds
00291 timer_.elapsed_time (delta_t);
00292 # if defined (ACE_LACKS_LONGLONG_T)
00293 et.real_time = delta_t / (double) ACE_ONE_SECOND_IN_NSECS;
00294 # else
00295 et.real_time = (__int64) delta_t / (double) ACE_ONE_SECOND_IN_NSECS;
00296 # endif /* ACE_LACKS_LONGLONG_T */
00297 # if defined (ACE_HAS_GETRUSAGE)
00298 ACE_Time_Value atv = ACE_Time_Value (this->end_usage_.ru_utime)
00299 - ACE_Time_Value (this->begin_usage_.ru_utime);
00300 et.user_time = atv.sec () + ((double) atv.usec ()) / ACE_ONE_SECOND_IN_USECS;
00301
00302 atv = ACE_Time_Value (this->end_usage_.ru_stime)
00303 - ACE_Time_Value (this->begin_usage_.ru_stime);
00304 et.system_time = atv.sec () + ((double) atv.usec ()) / ACE_ONE_SECOND_IN_USECS;
00305 # else /* ACE_HAS_GETRUSAGE */
00306 et.user_time = 0;
00307 et.system_time = 0;
00308 # endif /* ACE_HAS_GETRUSAGE */
00309
00310 return 0;
00311 }
|
|
|
Return the resource utilization (don't recompute it).
Definition at line 316 of file Profile_Timer.cpp. References ACE_TRACE, end_usage_, and Rusage.
00317 {
00318 ACE_TRACE ("ACE_Profile_Timer::get_rusage");
00319 # if defined (ACE_HAS_GETRUSAGE)
00320 usage = this->end_usage_;
00321 # else /* ACE_HAS_GETRUSAGE */
00322 usage = 0;
00323 # endif /* ACE_HAS_GETRUSAGE */
00324 }
|
|
|
Activate the timer.
Definition at line 84 of file Profile_Timer.i. References ACE_TRACE, ACE_High_Res_Timer::start, and timer_.
|
|
|
Stop the timer.
Definition at line 92 of file Profile_Timer.i. References ACE_TRACE, ACE_High_Res_Timer::stop, and timer_.
|
|
|
Declare the dynamic allocation hooks.
Definition at line 90 of file Profile_Timer.h. |
|
|
Keep track of the starting resource utilization.
Definition at line 97 of file Profile_Timer.h. Referenced by elapsed_rusage. |
|
|
Keep track of the ending resource utilization.
Definition at line 100 of file Profile_Timer.h. Referenced by elapsed_rusage, and get_rusage. |
|
|
Keep track of the last rusage for incremental timing.
Definition at line 103 of file Profile_Timer.h. |
|
|
The high resolution timer.
Definition at line 130 of file Profile_Timer.h. Referenced by dump, elapsed_time, start, and stop. |
1.2.14 written by Dimitri van Heesch,
© 1997-2002