29 using namespace Memstat;
41 #if !defined(__APPLE__)
47 fUseGNUBuiltinBacktrace(
kFALSE),
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;
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 void Delete(Option_t *option="")
Remove all objects from the list AND delete all heap based objects.
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 void Close()
Close - a static function This method stops the manager, flashes all the buffered data and closes the...
virtual void SetBins(Int_t nx, Double_t xmin, Double_t xmax)
Redefine x axis parameters.
virtual Int_t Fill()
Fill all branches.
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.
virtual void Info(const char *method, const char *msgfmt,...) const
Issue info message.
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...
virtual void SetAutoSave(Long64_t autos=-300000000)
This function may be called at the start of a program to change the default value for fAutoSave (and ...
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 Int_t GetNbinsX() const
Int_t GetEntriesFast() const
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)
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
virtual ~TMemStatMng()
if an instance is destructed - the hooks are reseted to old hooks
virtual TList * GetUserInfo()
Return a pointer to the list containing user objects associated to this tree.
virtual const char * GetFlagsDebug() const
Return the debug flags.
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
virtual const char * GetBuildNode() const
Return the build node name.
1-D histogram with a int per channel (see TH1 documentation)}
void AddPointer(void *ptr, Int_t size)
Add pointer to table.
char * Form(const char *fmt,...)
static FreeHookFunc_t GetFreeHook()
GetFreeHook - a static function free function getter.
virtual const char * GetBuildCompilerVersion() const
Return the build compiler version.
void SetName(const char *name)
virtual const char * GetFlagsOpt() const
Return the optimization flags.
const Int_t * GetArray() const
void Disable()
Disble memory hooks.
static TMemStatMng * fgInstance
tree to dump information
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
void getSymbolFullInfo(void *_pAddr, TString *_retInfo, const char *const _seporator=" | ")
Double_t AsDouble() const
virtual Int_t Branch(TCollection *list, Int_t bufsize=32000, Int_t splitlevel=99, const char *name="")
Create one branch for each element in the collection.
virtual void Add(TObject *obj)
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 MallocHookFunc_t GetMallocHook()
GetMallocHook - a static function malloc function getter.
static void FreeHook(void *ptr, const void *)
FreeHook - a static function A glibc memory deallocation hook.
virtual Long64_t GetEntries() const
A TTree object has a header with a name and a title.
static TMemStatMng * GetInstance()
GetInstance - a static function Initialize a singleton of MemStat manager.
Vc_ALWAYS_INLINE_L T *Vc_ALWAYS_INLINE_R malloc(size_t n)
Allocates memory on the Heap with alignment and padding suitable for vectorized access.
TMemStatHook::FreeHookFunc_t fPreviousFreeHook
old malloc function
TMemStatFAddrContainer fFAddrs
virtual Long64_t AutoSave(Option_t *option="")
AutoSave tree header every fAutoSave bytes.
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.