TMemStatDepend.h

Go to the documentation of this file.
00001 // @(#)root/memstat:$Name$:$Id: TMemStatDepend.h 30815 2009-10-20 13:49:22Z rdm $
00002 // Author: M.Ivanov   18/06/2007 -- Anar Manafov (A.Manafov@gsi.de) 28/04/2008
00003 
00004 /*************************************************************************
00005  * Copyright (C) 1995-2008, Rene Brun and Fons Rademakers.               *
00006  * All rights reserved.                                                  *
00007  *                                                                       *
00008  * For the licensing terms see $ROOTSYS/LICENSE.                         *
00009  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
00010  *************************************************************************/
00011 
00012 #ifndef ROOT_TMemStatDepend
00013 #define ROOT_TMemStatDepend
00014 
00015 #if !defined(__CINT__)
00016 #include <sys/types.h>
00017 #endif
00018 #ifndef ROOT_Rtypes
00019 #include "Rtypes.h"
00020 #endif
00021 
00022 //
00023 //  TMemStatDepend
00024 //  Non standard C++ functions
00025 //  Needed for memory statistic
00026 
00027 #define _INIT_TOP_STECK extern void *g_global_stack_end;
00028 #define _GET_TO_STECK g_global_stack_end = __builtin_frame_address(1);
00029 
00030 class TString;
00031 
00032 class TMemStatDepend
00033 {
00034 public:
00035    //
00036    // Memory management HOOK functions
00037    //
00038    typedef void* (*MallocHookFunc_t)(size_t size, const void *caller);
00039    typedef void (*FreeHookFunc_t)(void* ptr, const void *caller);
00040 
00041    static MallocHookFunc_t GetMallocHook();         // malloc function getter
00042    static FreeHookFunc_t   GetFreeHook();           // free function getter
00043    static void SetMallocHook(MallocHookFunc_t p);   // malloc function setter
00044    static void SetFreeHook(FreeHookFunc_t p);       // free function setter
00045    //
00046    // Backtrace functions
00047    //
00048    static size_t Backtrace(void **trace, size_t size, Bool_t _bUseGNUBuildinBacktrace = kFALSE);
00049    static char** BacktraceSymbols(void **trace, size_t size);
00050    static void GetSymbols(void *pFunction, TString &strInfo,  TString &strLib, TString &strFun, TString &strLine);
00051    static void Demangle(char *codeInfo, TString &str);
00052 };
00053 
00054 #endif

Generated on Tue Jul 5 14:43:44 2011 for ROOT_528-00b_version by  doxygen 1.5.1