ACE_Timeprobe_Ex< ACE_LOCK, ALLOCATOR > Class Template Reference

This class is used to instrument code. This is accomplished by inserting time probes at different location in the code. ACE_Timeprobe then measures the time difference between two time probes. More...

#include <Timeprobe_T.h>

Inheritance diagram for ACE_Timeprobe_Ex< ACE_LOCK, ALLOCATOR >:

Inheritance graph
[legend]
Collaboration diagram for ACE_Timeprobe_Ex< ACE_LOCK, ALLOCATOR >:

Collaboration graph
[legend]
List of all members.

Public Types

typedef ACE_Timeprobe_Ex<
ACE_LOCK, ALLOCATOR > 
SELF
 Self.

typedef ACE_Timeprobe_Ex<
ACE_LOCK, ACE_Allocator
ACE_Timeprobe
typedef ACE_Unbounded_Set<
ACE_Event_Descriptions
EVENT_DESCRIPTIONS
 We can hold multiple event description tables.


Public Member Functions

 ACE_Timeprobe_Ex (u_long size=ACE_DEFAULT_TIMEPROBE_TABLE_SIZE)
 Create Timeprobes with size slots.

 ACE_Timeprobe_Ex (ALLOCATOR *allocator, u_long size=ACE_DEFAULT_TIMEPROBE_TABLE_SIZE)
 Create Timeprobes with size slots.

 ~ACE_Timeprobe_Ex (void)
 Destructor.

void timeprobe (u_long event)
 Record a time. event is used to describe this time probe.

void timeprobe (const char *id)
 Record a time. id is used to describe this time probe.

int event_descriptions (const char **descriptions, u_long minimum_id)
 Record event descriptions.

void print_times (void)
 Print the time probes.

void print_absolute_times (void)
 Print the time probes.

void reset (void)
 Reset the slots. All old time probes will be lost.

void increase_size (u_long size)
 ACE_Timeprobe_Ex (const ACE_Timeprobe_Ex< ACE_LOCK, ALLOCATOR > &)
 Not implemented (stupid MSVC won't let it be protected).

ACE_Unbounded_Set< ACE_Event_Descriptions > & event_descriptions (void)
 Event Descriptions.

ACE_Unbounded_Set< ACE_Event_Descriptions > & sorted_event_descriptions (void)
 Sorted Event Descriptions.

const char * find_description_i (u_long i)
 Find description of event <i>.

void sort_event_descriptions_i (void)
 Sort event descriptions.

ACE_timeprobe_ttimeprobes (void)
 Time probe slots.

ACE_LOCK & lock (void)
 Synchronization variable.

u_long max_size (void)
 Max size of timestamp table.

u_long current_size (void)
 Current size of timestamp table.


Protected Member Functions

ALLOCATOR * allocator (void)

Protected Attributes

EVENT_DESCRIPTIONS event_descriptions_
 Event Descriptions.

EVENT_DESCRIPTIONS sorted_event_descriptions_
 Sorted Event Descriptions.

ACE_timeprobe_ttimeprobes_
 Time probe slots.

ACE_LOCK lock_
 Synchronization variable.

u_long max_size_
 Max size of timestamp table.

u_long current_size_
 Current size of timestamp table.

u_short report_buffer_full_

Private Attributes

ALLOCATOR * allocator_

Detailed Description

template<class ACE_LOCK, class ALLOCATOR>
class ACE_Timeprobe_Ex< ACE_LOCK, ALLOCATOR >

This class is used to instrument code. This is accomplished by inserting time probes at different location in the code. ACE_Timeprobe then measures the time difference between two time probes.

This class provides a lightweight implementation for measuring the time required to execute code between two time probes. When a time probe executes, it records the time, the id of the calling thread, and an event description. The event description can either be an unsigned long or a string (char *). If string are used, care must be taken cause only pointer copies are done and the string data is *not* copied. The recorded time probes can then be printed by calling . If you have used unsigned longs as event descriptions in any of your time probes, you must have provided an event description table that maps the unsigned longs to readable strings. This map is a simple array of strings, and the event number is used as the index into the array when looking for the event description. If you have only used strings for the event description, this map is not necessary. Multiple maps can also be used to chunk up the time probes. Each one can be added by calling . Different tables are used internally by consulting the minimum_id for each table. It is up to the user to make sure that multiple tables do not share the same event id range.

Definition at line 61 of file Timeprobe_T.h.


Member Typedef Documentation

template<class ACE_LOCK, class ALLOCATOR>
typedef ACE_Timeprobe_Ex<ACE_LOCK, ACE_Allocator> ACE_Timeprobe_Ex< ACE_LOCK, ALLOCATOR >::ACE_Timeprobe
 

ACE_Timeprobe

Definition at line 72 of file Timeprobe_T.h.

template<class ACE_LOCK, class ALLOCATOR>
typedef ACE_Unbounded_Set<ACE_Event_Descriptions> ACE_Timeprobe_Ex< ACE_LOCK, ALLOCATOR >::EVENT_DESCRIPTIONS
 

We can hold multiple event description tables.

Definition at line 77 of file Timeprobe_T.h.

template<class ACE_LOCK, class ALLOCATOR>
typedef ACE_Timeprobe_Ex<ACE_LOCK, ALLOCATOR> ACE_Timeprobe_Ex< ACE_LOCK, ALLOCATOR >::SELF
 

Self.

Definition at line 67 of file Timeprobe_T.h.


Constructor & Destructor Documentation

template<class ACE_LOCK, class ALLOCATOR>
ACE_BEGIN_VERSIONED_NAMESPACE_DECL ACE_Timeprobe_Ex< ACE_LOCK, ALLOCATOR >::ACE_Timeprobe_Ex u_long  size = ACE_DEFAULT_TIMEPROBE_TABLE_SIZE  ) 
 

Create Timeprobes with size slots.

Definition at line 21 of file Timeprobe_T.cpp.

References ACE_NEW_MALLOC_ARRAY, and ACE_Timeprobe_Ex< ACE_LOCK, ALLOCATOR >::timeprobes_.

00022   : timeprobes_ (0),
00023     lock_ (),
00024     max_size_ (size),
00025     current_size_ (0),
00026     report_buffer_full_ (0),
00027     allocator_ (0)
00028 {
00029   ACE_timeprobe_t *temp;
00030   ACE_NEW_MALLOC_ARRAY (temp,
00031                         (ACE_timeprobe_t *) this->allocator ()->
00032                         malloc (this->max_size_*sizeof(ACE_timeprobe_t)),
00033                         ACE_timeprobe_t,
00034                         this->max_size_);
00035   this->timeprobes_ = temp;
00036 
00037 }

template<class ACE_LOCK, class ALLOCATOR>
ACE_Timeprobe_Ex< ACE_LOCK, ALLOCATOR >::ACE_Timeprobe_Ex ALLOCATOR *  allocator,
u_long  size = ACE_DEFAULT_TIMEPROBE_TABLE_SIZE
 

Create Timeprobes with size slots.

Definition at line 41 of file Timeprobe_T.cpp.

References ACE_NEW_MALLOC_ARRAY, and ACE_Timeprobe_Ex< ACE_LOCK, ALLOCATOR >::timeprobes_.

00043   : timeprobes_ (0),
00044     lock_ (),
00045     max_size_ (size),
00046     current_size_ (0),
00047     report_buffer_full_ (0),
00048     allocator_ (allocator)
00049 {
00050   ACE_timeprobe_t *temp = 0;
00051   ACE_NEW_MALLOC_ARRAY (temp,
00052                         (ACE_timeprobe_t *) this->allocator ()->
00053                         malloc (this->max_size_*sizeof(ACE_timeprobe_t)),
00054                         ACE_timeprobe_t,
00055                         this->max_size_);
00056   this->timeprobes_ = temp;
00057 
00058 }

template<class ACE_LOCK, class ALLOCATOR>
ACE_Timeprobe_Ex< ACE_LOCK, ALLOCATOR >::~ACE_Timeprobe_Ex void   ) 
 

Destructor.

Definition at line 73 of file Timeprobe_T.cpp.

References ACE_DES_ARRAY_FREE.

00074 {
00075   ACE_DES_ARRAY_FREE ((ACE_timeprobe_t *) (this->timeprobes_),
00076                       this->max_size_,
00077                       this->allocator ()->free,
00078                       ACE_timeprobe_t);
00079 }

template<class ACE_LOCK, class ALLOCATOR>
ACE_Timeprobe_Ex< ACE_LOCK, ALLOCATOR >::ACE_Timeprobe_Ex const ACE_Timeprobe_Ex< ACE_LOCK, ALLOCATOR > &   ) 
 

Not implemented (stupid MSVC won't let it be protected).

Definition at line 61 of file Timeprobe_T.cpp.

References ACE_ERROR, ACE_LIB_TEXT, ENOTSUP, and LM_ERROR.

00062 {
00063   //
00064   // Stupid MSVC is forcing me to define this; please don't use it.
00065   //
00066 
00067   ACE_ERROR ((LM_ERROR,
00068               ACE_LIB_TEXT ("ACE_NOTSUP: %N, line %l\n")));
00069   errno = ENOTSUP;
00070 }


Member Function Documentation

template<class ACE_LOCK, class ALLOCATOR>
ALLOCATOR * ACE_Timeprobe_Ex< ACE_LOCK, ALLOCATOR >::allocator void   )  [protected]
 

Obtain an allocator pointer. If there is no allocator stored in the instance, the singleton allocator in the current process is used.

Definition at line 377 of file Timeprobe_T.cpp.

References ACE_Singleton< TYPE, ACE_LOCK >::instance().

Referenced by ACE_Metrics_Timeprobe< ACE_LOCK, ALLOCATOR >::probe_name(), and ACE_Metrics_Timeprobe< ACE_LOCK, ALLOCATOR >::~ACE_Metrics_Timeprobe().

template<class ACE_LOCK, class ALLOCATOR>
u_long ACE_Timeprobe_Ex< ACE_LOCK, ALLOCATOR >::current_size void   ) 
 

Current size of timestamp table.

Definition at line 195 of file Timeprobe_T.cpp.

00196 {
00197   return this->current_size_;
00198 }

template<class ACE_LOCK, class ALLOCATOR>
ACE_Unbounded_Set< ACE_Event_Descriptions > & ACE_Timeprobe_Ex< ACE_LOCK, ALLOCATOR >::event_descriptions void   ) 
 

Event Descriptions.

Definition at line 165 of file Timeprobe_T.cpp.

References ACE_Timeprobe_Ex< ACE_LOCK, ALLOCATOR >::event_descriptions_.

Referenced by ACE_Metrics_Timeprobe< ACE_LOCK, ALLOCATOR >::ACE_Metrics_Timeprobe().

00166 {
00167   return this->event_descriptions_;
00168 }

template<class ACE_LOCK, class ALLOCATOR>
int ACE_Timeprobe_Ex< ACE_LOCK, ALLOCATOR >::event_descriptions const char **  descriptions,
u_long  minimum_id
 

Record event descriptions.

Definition at line 201 of file Timeprobe_T.cpp.

References ACE_GUARD_RETURN, ACE_Event_Descriptions::descriptions_, ACE_Timeprobe_Ex< ACE_LOCK, ALLOCATOR >::event_descriptions_, ACE_Unbounded_Set< T >::insert(), and ACE_Event_Descriptions::minimum_id_.

00203 {
00204   ACE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1);
00205 
00206   ACE_Event_Descriptions events;
00207   events.descriptions_ = descriptions;
00208   events.minimum_id_ = minimum_id;
00209 
00210   this->event_descriptions_.insert (events);
00211 
00212   return 0;
00213 }

template<class ACE_LOCK, class ALLOCATOR>
const char * ACE_Timeprobe_Ex< ACE_LOCK, ALLOCATOR >::find_description_i u_long  i  ) 
 

Find description of event <i>.

Definition at line 331 of file Timeprobe_T.cpp.

References ACE_Unbounded_Set< T >::begin(), ACE_timeprobe_t::event_, ACE_timeprobe_t::event_type_, ACE_Unbounded_Set< T >::size(), ACE_Timeprobe_Ex< ACE_LOCK, ALLOCATOR >::sorted_event_descriptions_, and ACE_Timeprobe_Ex< ACE_LOCK, ALLOCATOR >::timeprobes_.

00332 {
00333   if (this->timeprobes_[i].event_type_ == ACE_timeprobe_t::STRING) {
00334     return this->timeprobes_[i].event_.event_description_;
00335   }
00336   else
00337     {
00338       EVENT_DESCRIPTIONS::iterator iterator = this->sorted_event_descriptions_.begin ();
00339       for (u_long j = 0;
00340            j < this->sorted_event_descriptions_.size () - 1;
00341            iterator++, j++)
00342         {
00343           EVENT_DESCRIPTIONS::iterator next_event_descriptions = iterator;
00344           ++next_event_descriptions;
00345 
00346           if (this->timeprobes_[i].event_.event_number_ < (*next_event_descriptions).minimum_id_)
00347             break;
00348         }
00349       return (*iterator).descriptions_[this->timeprobes_[i].event_.event_number_ - (*iterator).minimum_id_];
00350     }
00351 }

template<class ACE_LOCK, class ALLOCATOR>
void ACE_Timeprobe_Ex< ACE_LOCK, ALLOCATOR >::increase_size u_long  size  ) 
 

Definition at line 131 of file Timeprobe_T.cpp.

References ACE_DES_ARRAY_FREE, ACE_GUARD, ACE_NEW_MALLOC_ARRAY, ACE_OS::memcpy(), and ACE_Timeprobe_Ex< ACE_LOCK, ALLOCATOR >::timeprobes_.

00132 {
00133    ACE_GUARD (ACE_LOCK, ace_mon, this->lock_);
00134 
00135    if (size > this->max_size_)
00136    {
00137       ACE_timeprobe_t *temp = 0;
00138       ACE_NEW_MALLOC_ARRAY (temp,
00139                            (ACE_timeprobe_t *) this->allocator ()->
00140                            malloc (this->max_size_
00141                            * sizeof (ACE_timeprobe_t)),
00142                            ACE_timeprobe_t,
00143                            size);
00144 
00145       if (this->max_size_ > 0)
00146       {
00147          ACE_OS::memcpy (temp,
00148                          this->timeprobes_,
00149                          this->max_size_ * sizeof (ACE_timeprobe_t));
00150 
00151          // Iterates over the array explicitly calling the destructor for
00152          // each probe instance, then deallocates the memory
00153 
00154          ACE_DES_ARRAY_FREE ((ACE_timeprobe_t *)(this->timeprobes_),
00155                              this->max_size_,
00156                              this->allocator ()->free,
00157                              ACE_timeprobe_t);
00158       }
00159       this->timeprobes_ = temp;
00160       this->max_size_ = size;
00161    }
00162 }

template<class ACE_LOCK, class ALLOCATOR>
ACE_LOCK & ACE_Timeprobe_Ex< ACE_LOCK, ALLOCATOR >::lock void   ) 
 

Synchronization variable.

Definition at line 183 of file Timeprobe_T.cpp.

00184 {
00185   return this->lock_;
00186 }

template<class ACE_LOCK, class ALLOCATOR>
u_long ACE_Timeprobe_Ex< ACE_LOCK, ALLOCATOR >::max_size void   ) 
 

Max size of timestamp table.

Definition at line 189 of file Timeprobe_T.cpp.

00190 {
00191   return this->max_size_;
00192 }

template<class ACE_LOCK, class ALLOCATOR>
void ACE_Timeprobe_Ex< ACE_LOCK, ALLOCATOR >::print_absolute_times void   ) 
 

Print the time probes.

Definition at line 285 of file Timeprobe_T.cpp.

References ACE_DEBUG, ACE_GUARD, ACE_High_Res_Timer::hrtime_to_tv(), LM_DEBUG, ACE_Timeprobe_Ex< ACE_LOCK, ALLOCATOR >::report_buffer_full_, ACE_Time_Value::sec(), ACE_Timeprobe_Ex< ACE_LOCK, ALLOCATOR >::sort_event_descriptions_i(), ACE_timeprobe_t::thread_, ACE_Timeprobe_Ex< ACE_LOCK, ALLOCATOR >::timeprobes_, and ACE_Time_Value::usec().

00286 {
00287   ACE_GUARD (ACE_LOCK, ace_mon, this->lock_);
00288 
00289   // Sort the event descriptions
00290   this->sort_event_descriptions_i ();
00291 
00292   ACE_DEBUG ((LM_DEBUG,
00293               "\nACE_Timeprobe_Ex; %d timestamps were recorded:\n",
00294               this->current_size_));
00295 
00296   if (this->current_size_ == 0 && this->report_buffer_full_ == 0) {
00297     return;
00298   }
00299 
00300   ACE_DEBUG ((LM_DEBUG,
00301               "\n%-50.50s %8.8s %13.13s\n\n",
00302               "Event",
00303               "thread",
00304               "stamp"));
00305 
00306   u_long i;
00307   if (report_buffer_full_ == 0) {
00308     i = 1;
00309   }
00310   else {
00311     i = this->current_size_;
00312   }
00313 
00314   ACE_Time_Value tv; // to convert ACE_hrtime_t
00315   do
00316     {
00317       ACE_High_Res_Timer::hrtime_to_tv (tv, this->timeprobes_ [i].time_);
00318 
00319       ACE_DEBUG ((LM_DEBUG,
00320                   "%-50.50s %8.8x %12.12u\n",
00321                   this->find_description_i (i),
00322                   this->timeprobes_ [i].thread_,
00323                   tv.sec () * 1000000
00324                    + tv.usec ()));
00325       i = (i + 1) % this ->max_size_; // Modulus increment: loops around at the end.
00326 
00327     } while (i != this->current_size_);
00328 }

template<class ACE_LOCK, class ALLOCATOR>
void ACE_Timeprobe_Ex< ACE_LOCK, ALLOCATOR >::print_times void   ) 
 

Print the time probes.

Definition at line 216 of file Timeprobe_T.cpp.

References ACE_DEBUG, ACE_GUARD, ACE_hrtime_t, ACE_High_Res_Timer::global_scale_factor(), LM_DEBUG, ACE_Timeprobe_Ex< ACE_LOCK, ALLOCATOR >::report_buffer_full_, ACE_Timeprobe_Ex< ACE_LOCK, ALLOCATOR >::sort_event_descriptions_i(), ACE_timeprobe_t::thread_, ACE_timeprobe_t::time_, and ACE_Timeprobe_Ex< ACE_LOCK, ALLOCATOR >::timeprobes_.

00217 {
00218   ACE_GUARD (ACE_LOCK, ace_mon, this->lock_);
00219 
00220   // Sort the event descriptions
00221   this->sort_event_descriptions_i ();
00222 
00223   ACE_DEBUG ((LM_DEBUG,
00224               "\nACE_Timeprobe_Ex; %d timestamps were recorded:\n",
00225               this->current_size_));
00226 
00227   if (this->current_size_ == 0)
00228     return;
00229 
00230   ACE_DEBUG ((LM_DEBUG,
00231               "\n%-50.50s %8.8s %13.13s\n\n",
00232               "Event",
00233               "thread",
00234               "usec"));
00235 
00236   ACE_DEBUG ((LM_DEBUG,
00237               "%-50.50s %8.8x %13.13s\n",
00238               this->find_description_i (0),
00239               this->timeprobes_[0].thread_,
00240               "START"));
00241 
00242   ACE_UINT32 gsf = ACE_High_Res_Timer::global_scale_factor ();
00243   u_long i, j;
00244 
00245   if (report_buffer_full_ == 0) {
00246     i = 1;
00247   }
00248   else {
00249     i = this->current_size_;
00250   }
00251 
00252   do
00253     {
00254       if (i == 0) {
00255         j = this->max_size_;
00256       }
00257       else {
00258         j = i - 1;
00259       }
00260 
00261       ACE_hrtime_t time_difference =
00262         this->timeprobes_[i].time_ - this->timeprobes_[j].time_;
00263 
00264       ACE_UINT32 elapsed_time_in_micro_seconds =
00265         (ACE_UINT32) (time_difference / gsf);
00266       ACE_UINT32 remainder =
00267         (ACE_UINT32) (time_difference % gsf);
00268       // Convert to the fractional part in microseconds, with 3 digits
00269       // of precision (hence the 1000).
00270       ACE_UINT32 fractional = remainder * 1000 / gsf;
00271 
00272       ACE_DEBUG ((LM_DEBUG,
00273                   "%-50.50s %8.8x %10u.%03.3u\n",
00274                   this->find_description_i (i),
00275                   this->timeprobes_[i].thread_,
00276                   (unsigned int) elapsed_time_in_micro_seconds,
00277                   (unsigned int) fractional));
00278 
00279       i = (i + 1) % this ->max_size_; // Modulus increment: loops around at the end.
00280 
00281     } while (i != this->current_size_);
00282 }

template<class ACE_LOCK, class ALLOCATOR>
void ACE_Timeprobe_Ex< ACE_LOCK, ALLOCATOR >::reset void   ) 
 

Reset the slots. All old time probes will be lost.

Definition at line 122 of file Timeprobe_T.cpp.

References ACE_GUARD, and ACE_Timeprobe_Ex< ACE_LOCK, ALLOCATOR >::report_buffer_full_.

Referenced by ACE_Metrics_Cache< ACE_LOCK, ALLOCATOR >::reset_base_statistics().

00123 {
00124   ACE_GUARD (ACE_LOCK, ace_mon, this->lock_);
00125 
00126   this->current_size_ = 0;
00127   this->report_buffer_full_ = 0;
00128 }

template<class ACE_LOCK, class ALLOCATOR>
void ACE_Timeprobe_Ex< ACE_LOCK, ALLOCATOR >::sort_event_descriptions_i void   ) 
 

Sort event descriptions.

Definition at line 354 of file Timeprobe_T.cpp.

References ACE_Unbounded_Set< T >::begin(), ACE_Unbounded_Set< T >::end(), ACE_Timeprobe_Ex< ACE_LOCK, ALLOCATOR >::event_descriptions_, ACE_Unbounded_Set< T >::insert(), ACE_Event_Descriptions::minimum_id_, ACE_Unbounded_Set< T >::remove(), ACE_Unbounded_Set< T >::size(), and ACE_Timeprobe_Ex< ACE_LOCK, ALLOCATOR >::sorted_event_descriptions_.

Referenced by ACE_Timeprobe_Ex< ACE_LOCK, ALLOCATOR >::print_absolute_times(), and ACE_Timeprobe_Ex< ACE_LOCK, ALLOCATOR >::print_times().

00355 {
00356   size_t total_elements = this->event_descriptions_.size ();
00357 
00358   for (size_t i = 0;
00359        i < total_elements;
00360        i++)
00361     {
00362       EVENT_DESCRIPTIONS::iterator iterator = this->event_descriptions_.begin ();
00363       ACE_Event_Descriptions min_entry = *iterator;
00364 
00365       for (;
00366            iterator != this->event_descriptions_.end ();
00367            iterator++)
00368         if ((*iterator).minimum_id_ < min_entry.minimum_id_)
00369           min_entry = *iterator;
00370 
00371       this->sorted_event_descriptions_.insert (min_entry);
00372       this->event_descriptions_.remove (min_entry);
00373     }
00374 }

template<class ACE_LOCK, class ALLOCATOR>
ACE_Unbounded_Set< ACE_Event_Descriptions > & ACE_Timeprobe_Ex< ACE_LOCK, ALLOCATOR >::sorted_event_descriptions void   ) 
 

Sorted Event Descriptions.

Definition at line 171 of file Timeprobe_T.cpp.

References ACE_Timeprobe_Ex< ACE_LOCK, ALLOCATOR >::sorted_event_descriptions_.

00172 {
00173   return this->sorted_event_descriptions_;
00174 }

template<class ACE_LOCK, class ALLOCATOR>
void ACE_Timeprobe_Ex< ACE_LOCK, ALLOCATOR >::timeprobe const char *  id  ) 
 

Record a time. id is used to describe this time probe.

Definition at line 107 of file Timeprobe_T.cpp.

References ACE_ASSERT, ACE_GUARD, ACE_timeprobe_t::event_, ACE_timeprobe_t::event_type_, ACE_OS::gethrtime(), ACE_OS::thr_self(), ACE_timeprobe_t::thread_, ACE_timeprobe_t::time_, and ACE_Timeprobe_Ex< ACE_LOCK, ALLOCATOR >::timeprobes_.

00108 {
00109   ACE_GUARD (ACE_LOCK, ace_mon, this->lock_);
00110 
00111   ACE_ASSERT (this->current_size_ < this->max_size_);
00112 
00113   this->timeprobes_[this->current_size_].event_.event_description_ = event;
00114   this->timeprobes_[this->current_size_].event_type_ = ACE_timeprobe_t::STRING;
00115   this->timeprobes_[this->current_size_].time_ = ACE_OS::gethrtime ();
00116   this->timeprobes_[this->current_size_].thread_ = ACE_OS::thr_self ();
00117 
00118   ++this->current_size_;
00119 }

template<class ACE_LOCK, class ALLOCATOR>
void ACE_Timeprobe_Ex< ACE_LOCK, ALLOCATOR >::timeprobe u_long  event  ) 
 

Record a time. event is used to describe this time probe.

Definition at line 82 of file Timeprobe_T.cpp.

References ACE_ASSERT, ACE_GUARD, ACE_timeprobe_t::event_, ACE_timeprobe_t::event_type_, ACE_OS::gethrtime(), ACE_Timeprobe_Ex< ACE_LOCK, ALLOCATOR >::report_buffer_full_, ACE_OS::thr_self(), ACE_timeprobe_t::thread_, ACE_timeprobe_t::time_, and ACE_Timeprobe_Ex< ACE_LOCK, ALLOCATOR >::timeprobes_.

Referenced by ACE_Metrics_Cache< ACE_LOCK, ALLOCATOR >::report_dequeue_stop().

00083 {
00084   ACE_GUARD (ACE_LOCK, ace_mon, this->lock_);
00085 
00086 # if defined (ACE_TIMEPROBE_ASSERTS_FIXED_SIZE)
00087   ACE_ASSERT (this->current_size_ < this->max_size_);
00088 # else /* ! ACE_TIMEPROBE_ASSERTS_FIXED_SIZE */
00089   // wrap around to the beginning on overflow
00090   if (this->current_size_ >= this->max_size_)
00091     {
00092       this->current_size_ = 0;
00093       this->report_buffer_full_ = 1;
00094     }
00095 # endif /* ACE_TIMEPROBE_ASSERTS_FIXED_SIZE */
00096 
00097   this->timeprobes_[this->current_size_].event_.event_number_ = event;
00098   this->timeprobes_[this->current_size_].event_type_ = ACE_timeprobe_t::NUMBER;
00099   this->timeprobes_[this->current_size_].time_ = ACE_OS::gethrtime ();
00100   this->timeprobes_[this->current_size_].thread_ = ACE_OS::thr_self ();
00101 
00102   ++this->current_size_;
00103 
00104 }

template<class ACE_LOCK, class ALLOCATOR>
ACE_timeprobe_t * ACE_Timeprobe_Ex< ACE_LOCK, ALLOCATOR >::timeprobes void   ) 
 

Time probe slots.

Definition at line 177 of file Timeprobe_T.cpp.

References ACE_Timeprobe_Ex< ACE_LOCK, ALLOCATOR >::timeprobes_.

00178 {
00179   return this->timeprobes_;
00180 }


Member Data Documentation

template<class ACE_LOCK, class ALLOCATOR>
ALLOCATOR* ACE_Timeprobe_Ex< ACE_LOCK, ALLOCATOR >::allocator_ [private]
 

Definition at line 170 of file Timeprobe_T.h.

template<class ACE_LOCK, class ALLOCATOR>
u_long ACE_Timeprobe_Ex< ACE_LOCK, ALLOCATOR >::current_size_ [protected]
 

Current size of timestamp table.

Definition at line 160 of file Timeprobe_T.h.

template<class ACE_LOCK, class ALLOCATOR>
EVENT_DESCRIPTIONS ACE_Timeprobe_Ex< ACE_LOCK, ALLOCATOR >::event_descriptions_ [protected]
 

Event Descriptions.

Definition at line 145 of file Timeprobe_T.h.

Referenced by ACE_Timeprobe_Ex< ACE_LOCK, ALLOCATOR >::event_descriptions(), and ACE_Timeprobe_Ex< ACE_LOCK, ALLOCATOR >::sort_event_descriptions_i().

template<class ACE_LOCK, class ALLOCATOR>
ACE_LOCK ACE_Timeprobe_Ex< ACE_LOCK, ALLOCATOR >::lock_ [protected]
 

Synchronization variable.

Definition at line 154 of file Timeprobe_T.h.

template<class ACE_LOCK, class ALLOCATOR>
u_long ACE_Timeprobe_Ex< ACE_LOCK, ALLOCATOR >::max_size_ [protected]
 

Max size of timestamp table.

Definition at line 157 of file Timeprobe_T.h.

template<class ACE_LOCK, class ALLOCATOR>
u_short ACE_Timeprobe_Ex< ACE_LOCK, ALLOCATOR >::report_buffer_full_ [protected]
 

Flag indicating the report buffer has filled up, and is now acting as a ring-buffer using modulus arithmetic: this saves the max_size_ most recent time stamps and loses earlier ones until drained.

Definition at line 166 of file Timeprobe_T.h.

Referenced by ACE_Timeprobe_Ex< ACE_LOCK, ALLOCATOR >::print_absolute_times(), ACE_Timeprobe_Ex< ACE_LOCK, ALLOCATOR >::print_times(), ACE_Timeprobe_Ex< ACE_LOCK, ALLOCATOR >::reset(), and ACE_Timeprobe_Ex< ACE_LOCK, ALLOCATOR >::timeprobe().

template<class ACE_LOCK, class ALLOCATOR>
EVENT_DESCRIPTIONS ACE_Timeprobe_Ex< ACE_LOCK, ALLOCATOR >::sorted_event_descriptions_ [protected]
 

Sorted Event Descriptions.

Definition at line 148 of file Timeprobe_T.h.

Referenced by ACE_Timeprobe_Ex< ACE_LOCK, ALLOCATOR >::find_description_i(), ACE_Timeprobe_Ex< ACE_LOCK, ALLOCATOR >::sort_event_descriptions_i(), and ACE_Timeprobe_Ex< ACE_LOCK, ALLOCATOR >::sorted_event_descriptions().

template<class ACE_LOCK, class ALLOCATOR>
ACE_timeprobe_t* ACE_Timeprobe_Ex< ACE_LOCK, ALLOCATOR >::timeprobes_ [protected]
 

Time probe slots.

Definition at line 151 of file Timeprobe_T.h.

Referenced by ACE_Timeprobe_Ex< ACE_LOCK, ALLOCATOR >::ACE_Timeprobe_Ex(), ACE_Timeprobe_Ex< ACE_LOCK, ALLOCATOR >::find_description_i(), ACE_Timeprobe_Ex< ACE_LOCK, ALLOCATOR >::increase_size(), ACE_Timeprobe_Ex< ACE_LOCK, ALLOCATOR >::print_absolute_times(), ACE_Timeprobe_Ex< ACE_LOCK, ALLOCATOR >::print_times(), ACE_Timeprobe_Ex< ACE_LOCK, ALLOCATOR >::timeprobe(), and ACE_Timeprobe_Ex< ACE_LOCK, ALLOCATOR >::timeprobes().


The documentation for this class was generated from the following files:
Generated on Thu Nov 9 11:31:12 2006 for ACE by doxygen 1.3.6