summaryrefslogtreecommitdiff
path: root/ace
diff options
context:
space:
mode:
Diffstat (limited to 'ace')
-rw-r--r--ace/Timeprobe.cpp200
-rw-r--r--ace/Timeprobe.h174
-rw-r--r--ace/Timeprobe.i6
-rw-r--r--ace/Timeprobe_T.cpp196
-rw-r--r--ace/Timeprobe_T.h142
5 files changed, 363 insertions, 355 deletions
diff --git a/ace/Timeprobe.cpp b/ace/Timeprobe.cpp
index 578cfeb56e7..adc968a84fc 100644
--- a/ace/Timeprobe.cpp
+++ b/ace/Timeprobe.cpp
@@ -1,8 +1,5 @@
// $Id$
-#if !defined (ACE_TIMEPROBE_C)
-#define ACE_TIMEPROBE_C
-
#include "ace/Timeprobe.h"
#if defined (ACE_COMPILE_TIMEPROBES)
@@ -11,201 +8,6 @@
#include "ace/Timeprobe.i"
#endif /* __ACE_INLINE__ */
-#include "ace/High_Res_Timer.h"
-
-template <class ACE_LOCK>
-ACE_Timeprobe<ACE_LOCK>::ACE_Timeprobe (u_long size)
- : timeprobes_ (0),
- lock_ (),
- max_size_ (size),
- current_size_ (0)
-{
- this->timeprobes_ = new ACE_timeprobe_t[this->max_size_];
-
-#ifdef VXWORKS
- if (sysProcNumGet () == 0)
- {
- this->current_slot_vme_address_ = (u_int *) 0xDa010000;
- }
- else
- {
- this->current_slot_vme_address_ = (u_int *) 0xD8010000;
- }
-#endif // VXWORKS
-}
-
-template <class ACE_LOCK>
-ACE_Timeprobe<ACE_LOCK>::~ACE_Timeprobe (void)
-{
- delete [] this->timeprobes_;
-}
-
-template <class ACE_LOCK> void
-ACE_Timeprobe<ACE_LOCK>::timeprobe (u_long event)
-{
- ACE_GUARD (ACE_LOCK, ace_mon, this->lock_);
-
- ACE_ASSERT (this->current_size_ < this->max_size_);
-
- this->timeprobes_[this->current_size_].event_.event_number_ = event;
- this->timeprobes_[this->current_size_].event_type_ = ACE_timeprobe_t::NUMBER;
- this->timeprobes_[this->current_size_].time_ = ACE_OS::gethrtime ();
- this->timeprobes_[this->current_size_].thread_ = ACE_OS::thr_self ();
-
- this->current_size_++;
-
-#if defined (VMETRO_TIME_TEST) && (VXWORKS)
-
- // If we are using the VMETRO board to get time samples, then write
- // to the other boards VME address.
- *this->current_slot_vme_address_ = event;
-
-#endif /* VMETRO_TIME_TEST && VXWORKS */
-}
-
-template <class ACE_LOCK> void
-ACE_Timeprobe<ACE_LOCK>::timeprobe (const char *event)
-{
- ACE_GUARD (ACE_LOCK, ace_mon, this->lock_);
-
- ACE_ASSERT (this->current_size_ < this->max_size_);
-
- this->timeprobes_[this->current_size_].event_.event_description_ = event;
- this->timeprobes_[this->current_size_].event_type_ = ACE_timeprobe_t::STRING;
- this->timeprobes_[this->current_size_].time_ = ACE_OS::gethrtime ();
- this->timeprobes_[this->current_size_].thread_ = ACE_OS::thr_self ();
-
- this->current_size_++;
-}
-
-template <class ACE_LOCK> void
-ACE_Timeprobe<ACE_LOCK>::reset (void)
-{
- ACE_GUARD (ACE_LOCK, ace_mon, this->lock_);
-
- this->current_size_ = 0;
-}
-
-template <class ACE_LOCK> int
-ACE_Timeprobe<ACE_LOCK>::event_descriptions (const char **descriptions,
- u_long minimum_id)
-{
- ACE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1);
-
- ACE_Event_Descriptions events;
- events.descriptions_ = descriptions;
- events.minimum_id_ = minimum_id;
-
- this->event_descriptions_.insert (events);
-
- return 0;
-}
-
-template <class ACE_LOCK> void
-ACE_Timeprobe<ACE_LOCK>::print_times (void)
-{
- ACE_GUARD (ACE_LOCK, ace_mon, this->lock_);
-
- // Sort the event descriptions
- this->sort_event_descriptions_i ();
-
- ACE_DEBUG ((LM_DEBUG,
- "\nACE_Timeprobe; %d timestamps were recorded:\n",
- this->current_size_));
-
- if (this->current_size_ == 0)
- return;
-
- ACE_DEBUG ((LM_DEBUG,
- "\n%-50.50s %8.8s %13.13s\n\n",
- "Event",
- "thread",
- "usec"));
-
- ACE_DEBUG ((LM_DEBUG,
- "%-50.50s %8.8x %13.13s\n",
- this->find_description_i (0),
- this->timeprobes_[0].thread_,
- "START"));
-
- for (u_long i = 1; i < this->current_size_; i++)
- {
- ACE_hrtime_t time_difference =
- this->timeprobes_[i].time_ - this->timeprobes_[i-1].time_;
-
- ACE_UINT32 elapsed_time_in_micro_seconds =
- (ACE_UINT32) (time_difference / ACE_High_Res_Timer::global_scale_factor ());
-
- ACE_DEBUG ((LM_DEBUG,
- "%-50.50s %8.8x %13u\n",
- this->find_description_i (i),
- this->timeprobes_[i].thread_,
- (unsigned int) elapsed_time_in_micro_seconds));
- }
-}
-
-template <class ACE_LOCK> const char *
-ACE_Timeprobe<ACE_LOCK>::find_description_i (u_long i)
-{
- if (this->timeprobes_[i].event_type_ == ACE_timeprobe_t::STRING)
- return this->timeprobes_[i].event_.event_description_;
- else
- {
- EVENT_DESCRIPTIONS::iterator iterator = this->sorted_event_descriptions_.begin ();
- for (u_long j = 0;
- j < this->sorted_event_descriptions_.size () - 1;
- iterator++, j++)
- {
- EVENT_DESCRIPTIONS::iterator next_event_descriptions = iterator;
- next_event_descriptions++;
-
- if (this->timeprobes_[i].event_.event_number_ < (*next_event_descriptions).minimum_id_)
- break;
- }
- return (*iterator).descriptions_[this->timeprobes_[i].event_.event_number_ - (*iterator).minimum_id_];
- }
-}
-
-template <class ACE_LOCK> void
-ACE_Timeprobe<ACE_LOCK>::sort_event_descriptions_i (void)
-{
- size_t total_elements = this->event_descriptions_.size ();
-
- for (size_t i = 0;
- i < total_elements;
- i++)
- {
- EVENT_DESCRIPTIONS::iterator iterator = this->event_descriptions_.begin ();
- ACE_Event_Descriptions min_entry = *iterator;
-
- for (;
- iterator != this->event_descriptions_.end ();
- iterator++)
- {
- if ((*iterator).minimum_id_ < min_entry.minimum_id_)
- min_entry = *iterator;
- }
-
- this->sorted_event_descriptions_.insert (min_entry);
- this->event_descriptions_.remove (min_entry);
- }
-}
-
-template <class Timeprobe>
-ACE_Function_Timeprobe<Timeprobe>::ACE_Function_Timeprobe (Timeprobe &timeprobe,
- u_long event)
- : timeprobe_ (timeprobe),
- event_ (event)
-{
- this->timeprobe_.timeprobe (this->event_);
-}
-
-template <class Timeprobe>
-ACE_Function_Timeprobe<Timeprobe>::~ACE_Function_Timeprobe (void)
-{
- this->timeprobe_.timeprobe (this->event_ + 1);
-}
-
#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION)
template class ACE_Timeprobe<ACE_TIMEPROBE_MUTEX>;
template class ACE_Function_Timeprobe<ACE_Timeprobe<ACE_TIMEPROBE_MUTEX> >;
@@ -235,5 +37,3 @@ template class ACE_Singleton<ACE_TIMEPROBE_WITH_LOCKING, ACE_SYNCH_MUTEX>;
# endif /* ACE_TSS_TIMEPROBES */
#endif /* ACE_COMPILE_TIMEPROBES */
-
-#endif /* ACE_TIMEPROBE_C */
diff --git a/ace/Timeprobe.h b/ace/Timeprobe.h
index e29d0af56f8..d75c1240d83 100644
--- a/ace/Timeprobe.h
+++ b/ace/Timeprobe.h
@@ -3,185 +3,62 @@
#if !defined (ACE_TIMEPROBE_H)
#define ACE_TIMEPROBE_H
-// This class is compiled only when ACE_COMPILE_TIMEPROBES is defined
#if defined (ACE_COMPILE_TIMEPROBES)
#include "ace/Containers.h"
-// = Event Descriptions
-struct ACE_Event_Descriptions
+class ACE_Event_Descriptions
{
+ // = TITLE
+ // Event Descriptions.
+public:
const char **descriptions_;
// Event descriptions
u_long minimum_id_;
// Minimum id of this description set
- int operator== (const ACE_Event_Descriptions &rhs) const
- {
- return
- this->minimum_id_ == rhs.minimum_id_ &&
- this->descriptions_ == rhs.descriptions_;
- }
+ int operator== (const ACE_Event_Descriptions &rhs) const;
// Comparison
};
-// = Time probe record
-struct ACE_timeprobe_t
+class ACE_timeprobe_t
{
+ // = TITLE
+ // Time probe record.
+public:
+ // = Events are record as strings or numbers.
union event
{
u_long event_number_;
const char *event_description_;
};
- // Events are record as strings or numbers
+ // = Type of event.
enum event_type
{
NUMBER,
STRING
};
- // Type of event
event event_;
- // Event
+ // Event.
event_type event_type_;
- // Event type
+ // Type of event.
ACE_hrtime_t time_;
- // Timestamp
+ // Timestamp.
ACE_thread_t thread_;
- // Id of thread posting the time probe
+ // Id of thread posting the time probe.
};
-template <class ACE_LOCK>
-class ACE_Timeprobe
-{
- // = TITLE
- //
- // 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.
- //
- // = DESCRIPTION
- //
- // 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
- // print_times(). 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 event_descriptions().
- // 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.
-public:
-
- enum
- {
- ACE_DEFAULT_TABLE_SIZE = 4 * 1024
- // Default size of the slots in Timeprobe
- };
-
- ACE_Timeprobe (u_long size = ACE_DEFAULT_TABLE_SIZE);
- // Create Timeprobes with <size> slots
-
- ~ACE_Timeprobe (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 reset (void);
- // Reset the slots. All old time probes will be lost.
-
-protected:
-
- typedef ACE_Timeprobe<ACE_LOCK> SELF;
- // Self
-
- typedef ACE_Unbounded_Set<ACE_Event_Descriptions> EVENT_DESCRIPTIONS;
- // We can hold multiple event description tables
-
- EVENT_DESCRIPTIONS event_descriptions_;
- // Event Descriptions
-
- EVENT_DESCRIPTIONS sorted_event_descriptions_;
- // Sorted Event Descriptions
-
- u_int *current_slot_vme_address_;
- // Added sections below here to make compatible with the VMETRO
- // board test.
-
- ACE_Timeprobe (const ACE_Timeprobe &);
- // Not implemented.
-
- const char *find_description_i (u_long i);
- // Find description of event <i>
-
- void sort_event_descriptions_i (void);
- // Sort event descriptions
-
- ACE_timeprobe_t *timeprobes_;
- // 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
-};
-
-template <class Timeprobe>
-class ACE_Function_Timeprobe
-{
- // = TITLE
- //
- // Auto pointer like time probes. It will record <event> on
- // construction and <event + 1> on destruction.
- //
-public:
- ACE_Function_Timeprobe (Timeprobe &timeprobe,
- u_long event);
-
- ~ACE_Function_Timeprobe (void);
-
-protected:
-
- Timeprobe &timeprobe_;
-
- u_long event_;
-};
+#if defined (__ACE_INLINE__)
+#include "ace/Timeprobe.i"
+#endif /* __ACE_INLINE__ */
+#include "ace/Timeprobe_T.h"
#include "ace/Synch.h"
#include "ace/Singleton.h"
@@ -206,18 +83,6 @@ typedef ACE_TSS_Singleton<ACE_TIMEPROBE_WITH_LOCKING, ACE_SYNCH_NULL_MUTEX> ACE_
typedef ACE_Singleton<ACE_TIMEPROBE_WITH_LOCKING, ACE_SYNCH_MUTEX> ACE_TIMEPROBE_SINGLETON;
# endif /* ACE_TSS_TIMEPROBES */
-#if defined (__ACE_INLINE__)
-#include "ace/Timeprobe.i"
-#endif /* __ACE_INLINE__ */
-
-#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
-#include "ace/Timeprobe.cpp"
-#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
-
-#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
-#pragma implementation ("Timeprobe.cpp")
-#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
-
#endif /* ACE_COMPILE_TIMEPROBES */
// If ACE_ENABLE_TIMEPROBES is defined, the macros below will
@@ -240,5 +105,4 @@ typedef ACE_Singleton<ACE_TIMEPROBE_WITH_LOCKING, ACE_SYNCH_MUTEX> ACE_TIMEPROBE
# define ACE_FUNCTION_TIMEPROBE(X)
#endif /* ACE_ENABLE_TIMEPROBES */
-
#endif /* ACE_TIMEPROBE_H */
diff --git a/ace/Timeprobe.i b/ace/Timeprobe.i
index 74e88caa0c5..31f022f77b4 100644
--- a/ace/Timeprobe.i
+++ b/ace/Timeprobe.i
@@ -1,2 +1,8 @@
// $Id$
+ACE_INLINE int
+ACE_Event_Descriptions::operator== (const ACE_Event_Descriptions &rhs) const
+{
+ return this->minimum_id_ == rhs.minimum_id_ &&
+ this->descriptions_ == rhs.descriptions_;
+}
diff --git a/ace/Timeprobe_T.cpp b/ace/Timeprobe_T.cpp
new file mode 100644
index 00000000000..2ee6b4d99d3
--- /dev/null
+++ b/ace/Timeprobe_T.cpp
@@ -0,0 +1,196 @@
+// $Id$
+
+#if !defined (ACE_TIMEPROBE_T_C)
+#define ACE_TIMEPROBE_T_C
+
+#if defined (ACE_COMPILE_TIMEPROBES)
+#include "ace/High_Res_Timer.h"
+
+template <class ACE_LOCK>
+ACE_Timeprobe<ACE_LOCK>::ACE_Timeprobe (u_long size)
+ : timeprobes_ (0),
+ lock_ (),
+ max_size_ (size),
+ current_size_ (0)
+{
+ ACE_NEW (this->timeprobes_,
+ ACE_timeprobe_t[this->max_size_]);
+
+#ifdef VXWORKS
+ if (sysProcNumGet () == 0)
+ this->current_slot_vme_address_ = (u_int *) 0xDa010000;
+ else
+ this->current_slot_vme_address_ = (u_int *) 0xD8010000;
+#endif /* VXWORKS */
+}
+
+template <class ACE_LOCK>
+ACE_Timeprobe<ACE_LOCK>::~ACE_Timeprobe (void)
+{
+ delete [] this->timeprobes_;
+}
+
+template <class ACE_LOCK> void
+ACE_Timeprobe<ACE_LOCK>::timeprobe (u_long event)
+{
+ ACE_GUARD (ACE_LOCK, ace_mon, this->lock_);
+
+ ACE_ASSERT (this->current_size_ < this->max_size_);
+
+ this->timeprobes_[this->current_size_].event_.event_number_ = event;
+ this->timeprobes_[this->current_size_].event_type_ = ACE_timeprobe_t::NUMBER;
+ this->timeprobes_[this->current_size_].time_ = ACE_OS::gethrtime ();
+ this->timeprobes_[this->current_size_].thread_ = ACE_OS::thr_self ();
+
+ this->current_size_++;
+
+#if defined (VMETRO_TIME_TEST) && (VXWORKS)
+ // If we are using the VMETRO board to get time samples, then write
+ // to the other boards VME address.
+ *this->current_slot_vme_address_ = event;
+#endif /* VMETRO_TIME_TEST && VXWORKS */
+}
+
+template <class ACE_LOCK> void
+ACE_Timeprobe<ACE_LOCK>::timeprobe (const char *event)
+{
+ ACE_GUARD (ACE_LOCK, ace_mon, this->lock_);
+
+ ACE_ASSERT (this->current_size_ < this->max_size_);
+
+ this->timeprobes_[this->current_size_].event_.event_description_ = event;
+ this->timeprobes_[this->current_size_].event_type_ = ACE_timeprobe_t::STRING;
+ this->timeprobes_[this->current_size_].time_ = ACE_OS::gethrtime ();
+ this->timeprobes_[this->current_size_].thread_ = ACE_OS::thr_self ();
+
+ this->current_size_++;
+}
+
+template <class ACE_LOCK> void
+ACE_Timeprobe<ACE_LOCK>::reset (void)
+{
+ ACE_GUARD (ACE_LOCK, ace_mon, this->lock_);
+
+ this->current_size_ = 0;
+}
+
+template <class ACE_LOCK> int
+ACE_Timeprobe<ACE_LOCK>::event_descriptions (const char **descriptions,
+ u_long minimum_id)
+{
+ ACE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1);
+
+ ACE_Event_Descriptions events;
+ events.descriptions_ = descriptions;
+ events.minimum_id_ = minimum_id;
+
+ this->event_descriptions_.insert (events);
+
+ return 0;
+}
+
+template <class ACE_LOCK> void
+ACE_Timeprobe<ACE_LOCK>::print_times (void)
+{
+ ACE_GUARD (ACE_LOCK, ace_mon, this->lock_);
+
+ // Sort the event descriptions
+ this->sort_event_descriptions_i ();
+
+ ACE_DEBUG ((LM_DEBUG,
+ "\nACE_Timeprobe; %d timestamps were recorded:\n",
+ this->current_size_));
+
+ if (this->current_size_ == 0)
+ return;
+
+ ACE_DEBUG ((LM_DEBUG,
+ "\n%-50.50s %8.8s %13.13s\n\n",
+ "Event",
+ "thread",
+ "usec"));
+
+ ACE_DEBUG ((LM_DEBUG,
+ "%-50.50s %8.8x %13.13s\n",
+ this->find_description_i (0),
+ this->timeprobes_[0].thread_,
+ "START"));
+
+ for (u_long i = 1; i < this->current_size_; i++)
+ {
+ ACE_hrtime_t time_difference =
+ this->timeprobes_[i].time_ - this->timeprobes_[i-1].time_;
+
+ ACE_UINT32 elapsed_time_in_micro_seconds =
+ (ACE_UINT32) (time_difference / ACE_High_Res_Timer::global_scale_factor ());
+
+ ACE_DEBUG ((LM_DEBUG,
+ "%-50.50s %8.8x %13u\n",
+ this->find_description_i (i),
+ this->timeprobes_[i].thread_,
+ (unsigned int) elapsed_time_in_micro_seconds));
+ }
+}
+
+template <class ACE_LOCK> const char *
+ACE_Timeprobe<ACE_LOCK>::find_description_i (u_long i)
+{
+ if (this->timeprobes_[i].event_type_ == ACE_timeprobe_t::STRING)
+ return this->timeprobes_[i].event_.event_description_;
+ else
+ {
+ EVENT_DESCRIPTIONS::iterator iterator = this->sorted_event_descriptions_.begin ();
+ for (u_long j = 0;
+ j < this->sorted_event_descriptions_.size () - 1;
+ iterator++, j++)
+ {
+ EVENT_DESCRIPTIONS::iterator next_event_descriptions = iterator;
+ next_event_descriptions++;
+
+ if (this->timeprobes_[i].event_.event_number_ < (*next_event_descriptions).minimum_id_)
+ break;
+ }
+ return (*iterator).descriptions_[this->timeprobes_[i].event_.event_number_ - (*iterator).minimum_id_];
+ }
+}
+
+template <class ACE_LOCK> void
+ACE_Timeprobe<ACE_LOCK>::sort_event_descriptions_i (void)
+{
+ size_t total_elements = this->event_descriptions_.size ();
+
+ for (size_t i = 0;
+ i < total_elements;
+ i++)
+ {
+ EVENT_DESCRIPTIONS::iterator iterator = this->event_descriptions_.begin ();
+ ACE_Event_Descriptions min_entry = *iterator;
+
+ for (;
+ iterator != this->event_descriptions_.end ();
+ iterator++)
+ if ((*iterator).minimum_id_ < min_entry.minimum_id_)
+ min_entry = *iterator;
+
+ this->sorted_event_descriptions_.insert (min_entry);
+ this->event_descriptions_.remove (min_entry);
+ }
+}
+
+template <class Timeprobe>
+ACE_Function_Timeprobe<Timeprobe>::ACE_Function_Timeprobe (Timeprobe &timeprobe,
+ u_long event)
+ : timeprobe_ (timeprobe),
+ event_ (event)
+{
+ this->timeprobe_.timeprobe (this->event_);
+}
+
+template <class Timeprobe>
+ACE_Function_Timeprobe<Timeprobe>::~ACE_Function_Timeprobe (void)
+{
+ this->timeprobe_.timeprobe (this->event_ + 1);
+}
+
+#endif /* ACE_COMPILE_TIMEPROBES */
+#endif /* ACE_TIMEPROBE_T_C */
diff --git a/ace/Timeprobe_T.h b/ace/Timeprobe_T.h
new file mode 100644
index 00000000000..a02fec3cfaf
--- /dev/null
+++ b/ace/Timeprobe_T.h
@@ -0,0 +1,142 @@
+// $Id$
+
+#if !defined (ACE_TIMEPROBE_T_H)
+#define ACE_TIMEPROBE_T_H
+
+#if defined (ACE_COMPILE_TIMEPROBES)
+
+template <class ACE_LOCK>
+class ACE_Timeprobe
+{
+ // = TITLE
+ // 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.
+ //
+ // = DESCRIPTION
+ // 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
+ // print_times(). 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 event_descriptions().
+ // 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.
+public:
+ enum
+ {
+ ACE_DEFAULT_TABLE_SIZE = 4 * 1024
+ // Default size of the slots in Timeprobe
+ };
+
+ ACE_Timeprobe (u_long size = ACE_DEFAULT_TABLE_SIZE);
+ // Create Timeprobes with <size> slots
+
+ ~ACE_Timeprobe (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 reset (void);
+ // Reset the slots. All old time probes will be lost.
+
+protected:
+ typedef ACE_Timeprobe<ACE_LOCK>
+ SELF;
+ // Self
+
+ typedef ACE_Unbounded_Set<ACE_Event_Descriptions>
+ EVENT_DESCRIPTIONS;
+ // We can hold multiple event description tables.
+
+ EVENT_DESCRIPTIONS event_descriptions_;
+ // Event Descriptions
+
+ EVENT_DESCRIPTIONS sorted_event_descriptions_;
+ // Sorted Event Descriptions.
+
+ u_int *current_slot_vme_address_;
+ // Added sections below here to make compatible with the VMETRO
+ // board test.
+
+ ACE_Timeprobe (const ACE_Timeprobe &);
+ // Not implemented.
+
+ const char *find_description_i (u_long i);
+ // Find description of event <i>
+
+ void sort_event_descriptions_i (void);
+ // Sort event descriptions
+
+ ACE_timeprobe_t *timeprobes_;
+ // 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
+};
+
+template <class Timeprobe>
+class ACE_Function_Timeprobe
+{
+ // = TITLE
+ // Auto pointer like time probes. It will record <event> on
+ // construction and <event + 1> on destruction.
+public:
+ ACE_Function_Timeprobe (Timeprobe &timeprobe,
+ u_long event);
+ // Constructor.
+
+ ~ACE_Function_Timeprobe (void);
+ // Destructor.
+
+protected:
+ Timeprobe &timeprobe_;
+ // Reference to timeprobe.
+
+ u_long event_;
+ // Event.
+};
+
+#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
+#include "ace/Timeprobe_T.cpp"
+#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
+
+#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
+#pragma implementation ("Timeprobe_T.cpp")
+#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
+
+#endif /* ACE_COMPILE_TIMEPROBES */
+#endif /* ACE_TIMEPROBE_T_H */