diff options
author | coryan <coryan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1997-12-08 20:39:28 +0000 |
---|---|---|
committer | coryan <coryan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1997-12-08 20:39:28 +0000 |
commit | e505967aaa57e06383ef3df2819bc6d5944fa472 (patch) | |
tree | ff7cc21277d3b5ac3b445587a769876de358305a /TAO/tao/Timeprobe.h | |
parent | e99e03d48b28d4475de50ef61b4ddd1fb424f0b4 (diff) | |
download | ATCD-e505967aaa57e06383ef3df2819bc6d5944fa472.tar.gz |
ChangeLogTag:Mon Dec 8 13:11:46 1997 Carlos O'Ryan <coryan@macarena.cs.wustl.edu>
Diffstat (limited to 'TAO/tao/Timeprobe.h')
-rw-r--r-- | TAO/tao/Timeprobe.h | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/TAO/tao/Timeprobe.h b/TAO/tao/Timeprobe.h new file mode 100644 index 00000000000..99c29b148ef --- /dev/null +++ b/TAO/tao/Timeprobe.h @@ -0,0 +1,64 @@ +// +// $Id$ +// + +#ifndef ACE_TIMEPROBE_H +#define ACE_TIMEPROBE_H + +#include "ace/Synch.h" + +class ACE_Timeprobe +{ +public: + static ACE_Timeprobe &instance (); + + void timeprobe (const char *id); + + void print_times () const; + + void reset(); + + void destroy (); + +private: + ACE_Timeprobe (); + ~ACE_Timeprobe (); + + ACE_Timeprobe (const ACE_Timeprobe &); // not implemented + +private: + static ACE_Timeprobe *instance_; + + enum { SLOTS = 8192 }; + + ACE_SYNCH_MUTEX mutex_; + + u_int current_slot_; + + typedef struct timeprobe_info { + const char *id_; + ACE_hrtime_t time_; + ACE_thread_t thread_; + } timeprobe_t; + timeprobe_t timeprobes [SLOTS]; + + friend class null_friend_to_avoid_compiler_warning_about_no_friends; +}; + +#if defined (ACE_ENABLE_TIMEPROBES) +# define ACE_TIMEPROBE_RESET ACE_Timeprobe::instance ().reset () +# define ACE_TIMEPROBE(id) ACE_Timeprobe::instance ().timeprobe (id) +# define ACE_TIMEPROBE_PRINT ACE_Timeprobe::instance ().print_times () +# define ACE_TIMEPROBE_FINI ACE_Timeprobe::instance ().destroy () +#else +# define ACE_TIMEPROBE_RESET +# define ACE_TIMEPROBE(id) +# define ACE_TIMEPROBE_PRINT +# define ACE_TIMEPROBE_FINI +#endif /* ACE_ENABLE_TIMEPROBES */ + +#if defined (__ACE_INLINE__) +#include "Timeprobe.i" +#endif /* __ACE_INLINE__ */ + +#endif /* ACE_TIMEPROBE_H */ |