| # Gaudi Framework, version v25r0 |

Home |  | Generated: Mon Feb 17 2014

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups 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 <new>
7 # include <cstddef>
8
9 //<<<<<< PUBLIC DEFINES >>>>>>
10 //<<<<<< PUBLIC CONSTANTS >>>>>>
11 //<<<<<< PUBLIC TYPES >>>>>>
12 //<<<<<< PUBLIC VARIABLES >>>>>>
13 //<<<<<< PUBLIC FUNCTIONS >>>>>>
14 //<<<<<< CLASS DECLARATIONS >>>>>>
15
16 class IgHookTraceAlloc
17 {
18 public:
19 IgHookTraceAlloc (void);
20
21 void * allocate (size_t bytes);
22
23 private:
24 void * m_pool;
25 size_t m_left;
26 };
27
28 class IgHookTrace
29 {
30 public:
32 struct Counter { const char *m_name; };
33
35 class CounterValue
36 {
37 public:
38 void * operator new (size_t n, IgHookTraceAlloc *alloc = 0);
39
40 CounterValue (Counter *counter,
41 CounterValue *next = 0,
42 unsigned long long value = 0);
43 // implicit copy constructor
44 // implicit assignment operator
45 // implicit destructor
46
47 Counter * counter (void);
48 CounterValue * next (void);
49 unsigned long long count (void);
50
51 unsigned long long value (void);
52 unsigned long long tick (void);
53 unsigned long long untick (void);
54 unsigned long long add (unsigned long long value);
55 unsigned long long add (CounterValue &x);
56 unsigned long long sub (unsigned long long value);
57 unsigned long long sub (CounterValue &x);
58 unsigned long long max (unsigned long long value);
59 unsigned long long max (CounterValue &x);
60
61 private:
62 Counter *m_counter;
63 CounterValue *m_next;
64 unsigned long long m_value;
65 unsigned long long m_count;
66 };
67
68 // General utilities
69 static int stacktrace (void **addresses, int nmax);
70 static void * tosymbol (void *address);
71 static bool symbol (void *address, const char *&sym,
72 const char *&lib, int &offset,
73 int &liboffset);
74
75 void * operator new (size_t n, IgHookTraceAlloc *alloc = 0);
76
77 // Class methods
78 IgHookTrace (IgHookTrace *parent = 0, void *address = 0);
79
80 IgHookTrace * parent (void);
81 IgHookTrace * next (void);
82
83 void * address (void);
84 bool symbol (const char *&sym, const char *&lib,
85 int &offset, int &liboffset);
86
87 IgHookTrace * children (void);
88 IgHookTrace * child (void *address);
89
90 CounterValue * counters (void);
91 CounterValue * counter (Counter *id);
92
93 void merge (IgHookTrace *other);
94
95 private:
96 IgHookTraceAlloc *m_alloc;
97 IgHookTrace *m_parent;
98 IgHookTrace *m_next;
99 IgHookTrace *m_children;
100 void *m_address;
101 CounterValue *m_counters;
102 };
103
104 //<<<<<< INLINE PUBLIC FUNCTIONS >>>>>>
105 //<<<<<< INLINE MEMBER FUNCTIONS >>>>>>
106
107 #endif // IG_HOOK_IG_HOOK_TRACE_H