ACE_Profile_Timer Class Reference

This class provides both a timing mechanism and a mechanism for reporting the resource usage of a process. More...

#include <Profile_Timer.h>

Collaboration diagram for ACE_Profile_Timer:

Collaboration graph
[legend]
List of all members.

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.

Classes

class  ACE_Elapsed_Time
 Keeps track of the various user, system, and elapsed (real) times. More...

Detailed Description

This class provides both a timing mechanism and a mechanism for reporting the resource usage of a process.

Definition at line 34 of file Profile_Timer.h.


Member Typedef Documentation

typedef ACE_Rusage ACE_Profile_Timer::Rusage

Definition at line 57 of file Profile_Timer.h.


Constructor & Destructor Documentation

ACE_Profile_Timer::ACE_Profile_Timer ( void   ) 

Default constructor. Clears all time values to 0.

Definition at line 398 of file Profile_Timer.cpp.

References ACE_TRACE.

00399   : timer_ ()
00400 {
00401   ACE_TRACE ("ACE_Profile_Timer::ACE_Profile_Timer");
00402 }

ACE_INLINE ACE_Profile_Timer::~ACE_Profile_Timer ( void   ) 

Shutdown the timer.

Definition at line 123 of file Profile_Timer.inl.

00124 {
00125 }


Member Function Documentation

void ACE_Profile_Timer::compute_times ( ACE_Elapsed_Time et  )  [private]

Compute how much time has elapsed.

ACE_BEGIN_VERSIONED_NAMESPACE_DECL void ACE_Profile_Timer::dump ( void   )  const

Dump the state of an object.

Definition at line 390 of file Profile_Timer.cpp.

References ACE_TRACE, ACE_High_Res_Timer::dump(), and timer_.

00391 {
00392 #if defined (ACE_HAS_DUMP)
00393   ACE_TRACE ("ACE_Profile_Timer::dump");
00394   timer_.dump ();
00395 #endif /* ACE_HAS_DUMP */
00396 }

void ACE_Profile_Timer::elapsed_rusage ( ACE_Profile_Timer::Rusage rusage  ) 

Compute the amount of resource utilization between calls to start() and stop().

Definition at line 429 of file Profile_Timer.cpp.

References ACE_TRACE.

00430 {
00431   ACE_TRACE ("ACE_Profile_Timer::elapsed_rusage");
00432   usage = 0;
00433 }

int ACE_Profile_Timer::elapsed_time ( ACE_Elapsed_Time et  ) 

Compute the time elapsed between calls to start() and stop().

Definition at line 405 of file Profile_Timer.cpp.

References ACE_ONE_SECOND_IN_NSECS, ACE_TRACE, ACE_High_Res_Timer::elapsed_time(), ACE_Profile_Timer::ACE_Elapsed_Time::real_time, ACE_Profile_Timer::ACE_Elapsed_Time::system_time, timer_, and ACE_Profile_Timer::ACE_Elapsed_Time::user_time.

00406 {
00407   ACE_TRACE ("ACE_Profile_Timer::elapsed_time");
00408 
00409   ACE_hrtime_t delta_t; /* nanoseconds */
00410   timer_.elapsed_time (delta_t);
00411 
00412   et.real_time = delta_t / (double) ACE_ONE_SECOND_IN_NSECS;
00413 
00414   et.user_time = 0;
00415   et.system_time = 0;
00416 
00417   return 0;
00418 }

void ACE_Profile_Timer::get_rusage ( ACE_Profile_Timer::Rusage rusage  ) 

Return the resource utilization (don't recompute it).

Definition at line 421 of file Profile_Timer.cpp.

References ACE_TRACE.

00422 {
00423   ACE_TRACE ("ACE_Profile_Timer::get_rusage");
00424   usage = 0;
00425 }

ACE_BEGIN_VERSIONED_NAMESPACE_DECL ACE_INLINE int ACE_Profile_Timer::start ( void   ) 

Activate the timer.

Definition at line 107 of file Profile_Timer.inl.

References ACE_TRACE, ACE_High_Res_Timer::start(), and timer_.

00108 {
00109   ACE_TRACE ("ACE_Profile_Timer::start");
00110   this->timer_.start ();
00111   return 0;
00112 }

ACE_INLINE int ACE_Profile_Timer::stop ( void   ) 

Stop the timer.

Definition at line 115 of file Profile_Timer.inl.

References ACE_TRACE, ACE_High_Res_Timer::stop(), and timer_.

00116 {
00117   ACE_TRACE ("ACE_Profile_Timer::stop");
00118   this->timer_.stop ();
00119   return 0;
00120 }


Member Data Documentation

ACE_Profile_Timer::ACE_ALLOC_HOOK_DECLARE

Declare the dynamic allocation hooks.

Definition at line 88 of file Profile_Timer.h.

ACE_Profile_Timer::Rusage ACE_Profile_Timer::begin_usage_ [private]

Keep track of the starting resource utilization.

Definition at line 95 of file Profile_Timer.h.

ACE_Profile_Timer::Rusage ACE_Profile_Timer::end_usage_ [private]

Keep track of the ending resource utilization.

Definition at line 98 of file Profile_Timer.h.

ACE_Profile_Timer::Rusage ACE_Profile_Timer::last_usage_ [private]

Keep track of the last rusage for incremental timing.

Definition at line 101 of file Profile_Timer.h.

ACE_High_Res_Timer ACE_Profile_Timer::timer_ [private]

The high resolution timer.

Definition at line 128 of file Profile_Timer.h.

Referenced by dump(), elapsed_time(), start(), and stop().


The documentation for this class was generated from the following files:
Generated on Tue Feb 2 17:35:28 2010 for ACE by  doxygen 1.4.7