41 #
if !defined(__APPLE__)
47 fUseGNUBuiltinBacktrace(
kFALSE),
81 fDumpTree =
new TTree(
"T",
"Memory Statistics");
96 fHbtids =
new TH1I(
"btids",
"table of btids", 10000, 0, 1);
197 Info(
"~TMemStatMng",
">>> All free/malloc calls count: %d",
fBTIDCount);
236 #if defined(__APPLE__) 253 #if defined(__APPLE__) 254 TMemStatHook::untrackZoneMalloc();
345 void **stackPointers)
347 static Int_t old_btid = -1;
351 bool startCheck(
false);
354 if(old_digest.
fValue[i] != CRCdigest[i]) {
369 CRCSet_t::const_iterator found =
fBTChecksums.find(CRCdigest);
375 if(
fBTCount + stackEntries + 1 >= nbins) {
383 if(stackEntries <= 0) {
385 "A number of stack entries is equal or less than zero. For btid %d", ret_val);
389 std::pair<CRCSet_t::iterator, bool> res =
fBTChecksums.insert(CRCSet_t::value_type(CRCdigest, ret_val));
391 Error(
"AddPointer",
"Can't added a new BTID to the container.");
394 for(
int i = 0; i < stackEntries; ++i) {
400 strFuncAddr += func_addr;
401 TString strSymbolInfo;
409 Error(
"AddPointer",
"Can't add a function return address to the container");
418 ret_val = found->second;
438 md5.
Update(reinterpret_cast<UChar_t*>(stptr),
sizeof(
void*) * stackentries);
448 Error(
"AddPointer",
"bad BT id");
483 if (posj != pos)
break;
484 if (indmin > indj) indmin = indj;
485 if (indmax < indj) indmax = indj;
495 for (i=0;i<
fBufN;i++) {
void SetMaxCalls(Int_t maxcalls)
Set the maximum number of new/delete registered in the output Tree.
bool add(ULong_t addr, Int_t idx)
void Enable()
Enable memory hooks.
virtual int GetPid()
Get process id.
virtual const char * GetFlagsOpt() const
Return the optimization flags.
THist< 1, int, THistStatContent > TH1I
virtual void Info(const char *method, const char *msgfmt,...) const
Issue info message.
virtual const char * GetBuildCompilerVersion() const
Return the build compiler version.
void FillTree()
loop on all entries in the buffer and fill the output Tree entries with alloc and free in the buffer ...
void Final()
MD5 finalization, ends an MD5 message-digest operation, writing the the message digest and zeroizing ...
virtual void SetDirectory(TDirectory *dir)
By default when an histogram is created, it is added to the list of histogram objects in the current ...
static TMemStatMng * fgInstance
tree to dump information
static void Close()
Close - a static function This method stops the manager, flashes all the buffered data and closes the...
virtual const char * GetBuildNode() const
Return the build node name.
Double_t AsDouble() const
virtual void SetBins(Int_t nx, Double_t xmin, Double_t xmax)
Redefine x axis parameters.
virtual void SetOwner(Bool_t enable=kTRUE)
Set whether this collection is the owner (enable==true) of its content.
static void * AllocHook(size_t size, const void *)
AllocHook - a static function A glibc memory allocation hook.
const UShort_t g_digestSize
size_t getBacktrace(void **_trace, size_t _size, Bool_t _bUseGNUBuiltinBacktrace=kFALSE)
Get the backtrace _trace - array of pointers _size - maximal deepness of stack information _bUseGNUBu...
void Init()
old free function
static void SetFreeHook(FreeHookFunc_t p)
SetFreeHook - a static function Set pointer to function replacing free function.
static void SetMallocHook(MallocHookFunc_t p)
SetMallocHook - a static function Set pointer to function replacing alloc function.
virtual const char * GetFlagsDebug() const
Return the debug flags.
static void MacAllocHook(void *ptr, size_t size)
AllocHook - a static function a special memory hook for Mac OS X memory zones.
const size_t g_BTStackLevel
UChar_t fValue[g_digestSize]
This code implements the MD5 message-digest algorithm.
The TNamed class is the base class for all named ROOT classes.
TTree * fDumpTree
file to dump current information
void Set()
Set Date/Time to current time as reported by the system.
void Sort(Index n, const Element *a, Index *index, Bool_t down=kTRUE)
const Int_t * GetArray() const
virtual ~TMemStatMng()
if an instance is destructed - the hooks are reseted to old hooks
Bool_t fUseGNUBuiltinBacktrace
static void MacFreeHook(void *ptr)
AllocHook - a static function a special memory hook for Mac OS X memory zones.
void Update(const UChar_t *buf, UInt_t len)
Update TMD5 object to reflect the concatenation of another buffer full of bytes.
R__EXTERN TSystem * gSystem
void AddPointer(void *ptr, Int_t size)
Add pointer to table.
Int_t GetEntriesFast() const
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
char * Form(const char *fmt,...)
void SetName(const char *name)
void Disable()
Disble memory hooks.
unsigned long long ULong64_t
void SetBufferSize(Int_t buffersize)
Set the maximum number of alloc/free calls to be buffered.
TMemStatHook::MallocHookFunc_t fPreviousMallocHook
you should not use this method at all Int_t Int_t Double_t Double_t Double_t e
void getSymbolFullInfo(void *_pAddr, TString *_retInfo, const char *const _seporator=" | ")
Mother of all ROOT objects.
Int_t generateBTID(UChar_t *CRCdigest, Int_t stackEntries, void **stackPointers)
An internal function, which returns a bitid for a corresponding CRC digest cache variables.
static void FreeHook(void *ptr, const void *)
FreeHook - a static function A glibc memory deallocation hook.
virtual Int_t GetNbinsX() const
static TMemStatMng * GetInstance()
GetInstance - a static function Initialize a singleton of MemStat manager.
TMemStatHook::FreeHookFunc_t fPreviousFreeHook
old malloc function
TMemStatFAddrContainer fFAddrs
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.
if(line.BeginsWith("/*"))