Loading [MathJax]/extensions/tex2jax.js
The Gaudi Framework  v31r0 (aeb156f0)
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
IgHook_IgHookTrace.h
Go to the documentation of this file.
1 #ifndef IG_HOOK_IG_HOOK_TRACE_H
2 #define IG_HOOK_IG_HOOK_TRACE_H
3 
4 //<<<<<< INCLUDES >>>>>>
5 
6 #include <cstddef>
7 #include <new>
8 
9 //<<<<<< PUBLIC DEFINES >>>>>>
10 //<<<<<< PUBLIC CONSTANTS >>>>>>
11 //<<<<<< PUBLIC TYPES >>>>>>
12 //<<<<<< PUBLIC VARIABLES >>>>>>
13 //<<<<<< PUBLIC FUNCTIONS >>>>>>
14 //<<<<<< CLASS DECLARATIONS >>>>>>
15 
17 public:
18  IgHookTraceAlloc( void );
19 
20  void* allocate( size_t bytes );
21 
22 private:
23  void* m_pool;
24  size_t m_left;
25 };
26 
27 class IgHookTrace {
28 public:
30  struct Counter {
31  const char* m_name;
32  };
33 
35  class CounterValue {
36  public:
37  void* operator new( size_t n, IgHookTraceAlloc* alloc = 0 );
38 
39  CounterValue( Counter* counter, CounterValue* next = 0, unsigned long long value = 0 );
40  // implicit copy constructor
41  // implicit assignment operator
42  // implicit destructor
43 
44  Counter* counter( void );
45  CounterValue* next( void );
46  unsigned long long count( void );
47 
48  unsigned long long value( void );
49  unsigned long long tick( void );
50  unsigned long long untick( void );
51  unsigned long long add( unsigned long long value );
52  unsigned long long add( CounterValue& x );
53  unsigned long long sub( unsigned long long value );
54  unsigned long long sub( CounterValue& x );
55  unsigned long long max( unsigned long long value );
56  unsigned long long max( CounterValue& x );
57 
58  private:
60  CounterValue* m_next;
61  unsigned long long m_value;
62  unsigned long long m_count;
63  };
64 
65  // General utilities
66  static int stacktrace( void** addresses, int nmax );
67  static void* tosymbol( void* address );
68  static bool symbol( void* address, const char*& sym, const char*& lib, int& offset, int& liboffset );
69 
70  void* operator new( size_t n, IgHookTraceAlloc* alloc = 0 );
71 
72  // Class methods
73  IgHookTrace( IgHookTrace* parent = 0, void* address = 0 );
74 
75  IgHookTrace* parent( void );
76  IgHookTrace* next( void );
77 
78  void* address( void );
79  bool symbol( const char*& sym, const char*& lib, int& offset, int& liboffset );
80 
81  IgHookTrace* children( void );
82  IgHookTrace* child( void* address );
83 
84  CounterValue* counters( void );
86 
87  void merge( IgHookTrace* other );
88 
89 private:
94  void* m_address;
96 };
97 
98 //<<<<<< INLINE PUBLIC FUNCTIONS >>>>>>
99 //<<<<<< INLINE MEMBER FUNCTIONS >>>>>>
100 
101 #endif // IG_HOOK_IG_HOOK_TRACE_H
EventIDBase max(const EventIDBase &lhs, const EventIDBase &rhs)
Definition: EventIDBase.h:215
IgHookTrace * m_children
IgHookTrace * m_parent
Value for a counter chained from a trace.
unsigned long long m_value
Nearly dummy object type to identify a counter.
IgHookTrace * m_next
unsigned long long m_count
CounterValue * m_counters
IgHookTraceAlloc * m_alloc
void * allocate(size_t bytes)