*Backed out changeset 3be01fb200a5
--HG-- branch : trunk
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
// -*- C++ -*-
|
||||
|
||||
//=============================================================================
|
||||
/**
|
||||
* @file Timeprobe_T.h
|
||||
@@ -9,16 +10,23 @@
|
||||
*/
|
||||
//=============================================================================
|
||||
|
||||
|
||||
#ifndef ACE_TIMEPROBE_T_H
|
||||
#define ACE_TIMEPROBE_T_H
|
||||
#include /**/ "ace/pre.h"
|
||||
|
||||
#include /**/ "ace/config-all.h"
|
||||
|
||||
#if !defined (ACE_LACKS_PRAGMA_ONCE)
|
||||
# pragma once
|
||||
#endif /* ACE_LACKS_PRAGMA_ONCE */
|
||||
|
||||
#if defined (ACE_COMPILE_TIMEPROBES)
|
||||
|
||||
#include "ace/Unbounded_Set.h"
|
||||
|
||||
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
|
||||
|
||||
/**
|
||||
* @class ACE_Timeprobe_Ex
|
||||
*
|
||||
@@ -53,91 +61,126 @@ template <class ACE_LOCK, class ALLOCATOR>
|
||||
class ACE_Timeprobe_Ex
|
||||
{
|
||||
public:
|
||||
|
||||
/// Self
|
||||
typedef ACE_Timeprobe_Ex<ACE_LOCK, ALLOCATOR>
|
||||
SELF;
|
||||
|
||||
/**
|
||||
* ACE_Timeprobe
|
||||
*/
|
||||
typedef ACE_Timeprobe_Ex <ACE_LOCK, ACE_Allocator> ACE_Timeprobe;
|
||||
|
||||
|
||||
/// We can hold multiple event description tables.
|
||||
typedef ACE_Unbounded_Set<ACE_Event_Descriptions>
|
||||
EVENT_DESCRIPTIONS;
|
||||
|
||||
/// Create Timeprobes with @a size slots
|
||||
ACE_Timeprobe_Ex (u_long size = ACE_DEFAULT_TIMEPROBE_TABLE_SIZE);
|
||||
|
||||
/// Create Timeprobes with @a size slots
|
||||
ACE_Timeprobe_Ex (ALLOCATOR *allocator,
|
||||
u_long size = ACE_DEFAULT_TIMEPROBE_TABLE_SIZE);
|
||||
/// Destructor.
|
||||
~ACE_Timeprobe_Ex (void);
|
||||
|
||||
/// Record a time. @a event is used to describe this time probe.
|
||||
void timeprobe (u_long event);
|
||||
|
||||
/// Record a time. @a id is used to describe this time probe.
|
||||
void timeprobe (const char *id);
|
||||
|
||||
/// Record event descriptions.
|
||||
int event_descriptions (const char **descriptions,
|
||||
u_long minimum_id);
|
||||
|
||||
/// Print the time probes.
|
||||
void print_times (void);
|
||||
|
||||
/// Print the time probes.
|
||||
void print_absolute_times (void);
|
||||
|
||||
/// Reset the slots. All old time probes will be lost.
|
||||
void reset (void);
|
||||
|
||||
void increase_size (u_long size);
|
||||
|
||||
/// Not implemented (stupid MSVC won't let it be protected).
|
||||
ACE_Timeprobe_Ex (const ACE_Timeprobe_Ex<ACE_LOCK, ALLOCATOR> &);
|
||||
|
||||
// = (Somewhat private) Accessors
|
||||
|
||||
/// Event Descriptions
|
||||
ACE_Unbounded_Set<ACE_Event_Descriptions> &event_descriptions (void);
|
||||
|
||||
/// Sorted Event Descriptions.
|
||||
ACE_Unbounded_Set<ACE_Event_Descriptions> &sorted_event_descriptions (void);
|
||||
|
||||
/// Find description of event @a i
|
||||
const char *find_description_i (u_long i);
|
||||
|
||||
/// Sort event descriptions
|
||||
void sort_event_descriptions_i (void);
|
||||
|
||||
/// Time probe slots
|
||||
ACE_timeprobe_t *timeprobes (void);
|
||||
|
||||
/// Synchronization variable.
|
||||
ACE_LOCK &lock (void);
|
||||
|
||||
/// Max size of timestamp table
|
||||
u_long max_size (void);
|
||||
|
||||
/// Current size of timestamp table
|
||||
u_long current_size (void);
|
||||
|
||||
protected:
|
||||
|
||||
/// Obtain an allocator pointer. If there is no allocator stored in
|
||||
/// the instance, the singleton allocator in the current process is used.
|
||||
ALLOCATOR * allocator (void);
|
||||
|
||||
/// Event Descriptions
|
||||
EVENT_DESCRIPTIONS event_descriptions_;
|
||||
|
||||
/// Sorted Event Descriptions.
|
||||
EVENT_DESCRIPTIONS sorted_event_descriptions_;
|
||||
|
||||
/// Time probe slots
|
||||
ACE_timeprobe_t *timeprobes_;
|
||||
|
||||
/// Synchronization variable.
|
||||
ACE_LOCK lock_;
|
||||
|
||||
/// Max size of timestamp table
|
||||
u_long max_size_;
|
||||
|
||||
/// Current size of timestamp table
|
||||
u_long current_size_;
|
||||
|
||||
/// 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.
|
||||
u_short report_buffer_full_;
|
||||
|
||||
private:
|
||||
ALLOCATOR * allocator_;
|
||||
};
|
||||
|
||||
// template <class ACE_LOCK>
|
||||
// class ACE_Timeprobe : public ACE_Timeprobe_Ex <ACE_LOCK, ACE_Allocator>
|
||||
// {
|
||||
// public:
|
||||
// // Initialize a ACE_Timeprobe with default size
|
||||
// ACE_Timeprobe (ACE_Allocator *allocator = ACE_Allocator::instance());
|
||||
|
||||
// /// Create Timeprobes with @a size slots
|
||||
// ACE_Timeprobe (ACE_Allocator *allocator = ACE_Allocator::instance(),
|
||||
// u_long size = ACE_DEFAULT_TIMEPROBE_TABLE_SIZE);
|
||||
// };
|
||||
|
||||
/**
|
||||
* @class ACE_Function_Timeprobe
|
||||
*
|
||||
@@ -150,21 +193,28 @@ class ACE_Function_Timeprobe
|
||||
public:
|
||||
/// Constructor.
|
||||
ACE_Function_Timeprobe (Timeprobe &timeprobe, u_long event);
|
||||
|
||||
/// Destructor.
|
||||
~ACE_Function_Timeprobe (void);
|
||||
|
||||
protected:
|
||||
/// Reference to timeprobe.
|
||||
Timeprobe &timeprobe_;
|
||||
|
||||
/// Event.
|
||||
u_long event_;
|
||||
};
|
||||
|
||||
ACE_END_VERSIONED_NAMESPACE_DECL
|
||||
|
||||
#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 */
|
||||
#include /**/ "ace/post.h"
|
||||
#endif /* ACE_TIMEPROBE_T_H */
|
||||
|
||||
Reference in New Issue
Block a user