diff options
author | coryan <coryan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2000-11-01 22:17:39 +0000 |
---|---|---|
committer | coryan <coryan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2000-11-01 22:17:39 +0000 |
commit | 53284e215e3d3351a7d7e9c4b68f14b427fb4377 (patch) | |
tree | 97236ece363cff48fd287c780db4290da39b02cb /ace/Timeprobe_T.h | |
parent | 7b7c52ad2abd228138ba1a948d5e28bf6dc3b880 (diff) | |
download | ATCD-53284e215e3d3351a7d7e9c4b68f14b427fb4377.tar.gz |
ChangeLogTag:Wed Nov 1 14:11:48 2000 Carlos O'Ryan <coryan@uci.edu>
Diffstat (limited to 'ace/Timeprobe_T.h')
-rw-r--r-- | ace/Timeprobe_T.h | 143 |
1 files changed, 78 insertions, 65 deletions
diff --git a/ace/Timeprobe_T.h b/ace/Timeprobe_T.h index 3850020415a..41744e153d8 100644 --- a/ace/Timeprobe_T.h +++ b/ace/Timeprobe_T.h @@ -1,5 +1,15 @@ /* -*- C++ -*- */ -// $Id$ + +//============================================================================= +/** + * @file Timeprobe_T.h + * + * $Id$ + * + * @author Irfan Pyarali + */ +//============================================================================= + #ifndef ACE_TIMEPROBE_T_H #define ACE_TIMEPROBE_T_H @@ -15,151 +25,154 @@ #include "ace/Containers.h" +/** + * @class ACE_Timeprobe + * + * @brief 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 + * <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. + */ 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: + /// Self typedef ACE_Timeprobe<ACE_LOCK> SELF; - // Self + /// We can hold multiple event description tables. typedef ACE_Unbounded_Set<ACE_Event_Descriptions> EVENT_DESCRIPTIONS; - // We can hold multiple event description tables. + /// Create Timeprobes with <size> slots ACE_Timeprobe (u_long size = ACE_DEFAULT_TIMEPROBE_TABLE_SIZE); - // Create Timeprobes with <size> slots + /// Destructor. ~ACE_Timeprobe (void); - // Destructor. + /// Record a time. <event> is used to describe this time probe. void timeprobe (u_long event); - // Record a time. <event> is used to describe this time probe. + /// Record a time. <id> is used to describe this time probe. void timeprobe (const char *id); - // Record a time. <id> is used to describe this time probe. + /// Record event descriptions. int event_descriptions (const char **descriptions, u_long minimum_id); - // Record event descriptions. + /// Print the time probes. void print_times (void); - // Print the time probes. + /// Print the time probes. void print_absolute_times (void); - // Print the time probes. + /// Reset the slots. All old time probes will be lost. void reset (void); - // Reset the slots. All old time probes will be lost. ACE_Timeprobe (const ACE_Timeprobe<ACE_LOCK> &); // Not implemented (stupid MSVC won't let it be protected). // = (Somewhat private) Accessors + /// Event Descriptions ACE_Unbounded_Set<ACE_Event_Descriptions> &event_descriptions (void); - // Event Descriptions + /// Sorted Event Descriptions. ACE_Unbounded_Set<ACE_Event_Descriptions> &sorted_event_descriptions (void); - // Sorted Event Descriptions. + /// VME slot address. u_int *current_slot_vme_address (void); - // VME slot address. + /// Find description of event <i> const char *find_description_i (u_long i); - // Find description of event <i> + /// Sort event descriptions void sort_event_descriptions_i (void); - // Sort event descriptions + /// Time probe slots ACE_timeprobe_t *timeprobes (void); - // Time probe slots + /// Synchronization variable. ACE_LOCK &lock (void); - // Synchronization variable. + /// Max size of timestamp table u_long max_size (void); - // Max size of timestamp table + /// Current size of timestamp table u_long current_size (void); - // Current size of timestamp table protected: + /// Event Descriptions EVENT_DESCRIPTIONS event_descriptions_; - // Event Descriptions + /// Sorted Event Descriptions. EVENT_DESCRIPTIONS sorted_event_descriptions_; - // Sorted Event Descriptions. + /// Added sections below here to make compatible with the VMETRO + /// board test. u_int *current_slot_vme_address_; - // Added sections below here to make compatible with the VMETRO - // board test. + /// Time probe slots ACE_timeprobe_t *timeprobes_; - // Time probe slots + /// Synchronization variable. ACE_LOCK lock_; - // Synchronization variable. + /// Max size of timestamp table u_long max_size_; - // Max size of timestamp table + /// Current size of timestamp table u_long current_size_; - // Current size of timestamp table }; +/** + * @class ACE_Function_Timeprobe + * + * @brief Auto pointer like time probes. It will record <event> on + * construction and <event + 1> on destruction. + */ 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: + /// Constructor. ACE_Function_Timeprobe (Timeprobe &timeprobe, u_long event); - // Constructor. + /// Destructor. ~ACE_Function_Timeprobe (void); - // Destructor. protected: + /// Reference to timeprobe. Timeprobe &timeprobe_; - // Reference to timeprobe. + /// Event. u_long event_; - // Event. }; #if defined (ACE_TEMPLATES_REQUIRE_SOURCE) |