| # Gaudi Framework, version v22r4 |

Home |  | Generated: Fri Sep 2 2011

# IgHook_IgHookTrace.h

Go to the documentation of this file.

    00001 #ifndef IG_HOOK_IG_HOOK_TRACE_H
    00002 # define IG_HOOK_IG_HOOK_TRACE_H
    00003
    00004 //<<<<<< INCLUDES                                                       >>>>>>
    00005
    00006 # include <new>
    00007
    00008 //<<<<<< PUBLIC DEFINES                                                 >>>>>>
    00009 //<<<<<< PUBLIC CONSTANTS                                               >>>>>>
    00010 //<<<<<< PUBLIC TYPES                                                   >>>>>>
    00011 //<<<<<< PUBLIC VARIABLES                                               >>>>>>
    00012 //<<<<<< PUBLIC FUNCTIONS                                               >>>>>>
    00013 //<<<<<< CLASS DECLARATIONS                                             >>>>>>
    00014
    00015 class IgHookTraceAlloc
    00016 {
    00017 public:
    00018     IgHookTraceAlloc (void);
    00019
    00020     void *      allocate (size_t bytes);
    00021
    00022 private:
    00023     void *      m_pool;
    00024     size_t      m_left;
    00025 };
    00026
    00027 class IgHookTrace
    00028 {
    00029 public:
    00031     struct Counter { const char *m_name; };
    00032
    00034     class CounterValue
    00035     {
    00036     public:
    00037         void *                  operator new (size_t n, IgHookTraceAlloc *alloc = 0);
    00038
    00039         CounterValue (Counter *counter,
    00040                       CounterValue *next = 0,
    00041                       unsigned long long value = 0);
    00042         // implicit copy constructor
    00043         // implicit assignment operator
    00044         // implicit destructor
    00045
    00046         Counter *               counter (void);
    00047         CounterValue *          next (void);
    00048         unsigned long long      count (void);
    00049
    00050         unsigned long long      value (void);
    00051         unsigned long long      tick (void);
    00052         unsigned long long      untick (void);
    00053         unsigned long long      add (unsigned long long value);
    00054         unsigned long long      add (CounterValue &x);
    00055         unsigned long long      sub (unsigned long long value);
    00056         unsigned long long      sub (CounterValue &x);
    00057         unsigned long long      max (unsigned long long value);
    00058         unsigned long long      max (CounterValue &x);
    00059
    00060     private:
    00061         Counter                 *m_counter;
    00062         CounterValue            *m_next;
    00063         unsigned long long      m_value;
    00064         unsigned long long      m_count;
    00065     };
    00066
    00067     // General utilities
    00068     static int          stacktrace (void **addresses, int nmax);
    00069     static void *       tosymbol (void *address);
    00070     static bool         symbol (void *address, const char *&sym,
    00071                                 const char *&lib, int &offset,
    00072                                 int &liboffset);
    00073
    00074     void *              operator new (size_t n, IgHookTraceAlloc *alloc = 0);
    00075
    00076     // Class methods
    00077     IgHookTrace (IgHookTrace *parent = 0, void *address = 0);
    00078
    00079     IgHookTrace *       parent (void);
    00080     IgHookTrace *       next (void);
    00081
    00082     void *              address (void);
    00083     bool                symbol (const char *&sym, const char *&lib,
    00084                                 int &offset, int &liboffset);
    00085
    00086     IgHookTrace *       children (void);
    00087     IgHookTrace *       child (void *address);
    00088
    00089     CounterValue *      counters (void);
    00090     CounterValue *      counter (Counter *id);
    00091
    00092     void                merge (IgHookTrace *other);
    00093
    00094 private:
    00095     IgHookTraceAlloc    *m_alloc;
    00096     IgHookTrace         *m_parent;
    00097     IgHookTrace         *m_next;
    00098     IgHookTrace         *m_children;
    00099     void                *m_address;
    00100     CounterValue        *m_counters;
    00101 };
    00102
    00103 //<<<<<< INLINE PUBLIC FUNCTIONS                                        >>>>>>
    00104 //<<<<<< INLINE MEMBER FUNCTIONS                                        >>>>>>
    00105
    00106 #endif // IG_HOOK_IG_HOOK_TRACE_H

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines