| # Gaudi Framework, version v23r1 |

Home |  | Generated: Wed Feb 29 2012

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

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