From d77786724d91a1b6fd9f33b7f91516ee2d3b1b4b Mon Sep 17 00:00:00 2001 From: Anar Manafov <anar.manafov@gmail.com> Date: Fri, 26 Nov 2010 19:44:18 +0000 Subject: [PATCH] added and code, which dumps the content of MemStat database -- for debugging only git-svn-id: http://root.cern.ch/svn/root/trunk@36990 27541ba8-7e3a-0410-8455-c3a389f83636 --- misc/memstat/src/TMemStatMng.cxx | 38 +++++++++++++++++++++++++++++--- 1 file changed, 35 insertions(+), 3 deletions(-) diff --git a/misc/memstat/src/TMemStatMng.cxx b/misc/memstat/src/TMemStatMng.cxx index dcb884c3fb5..26acbc9ae4a 100644 --- a/misc/memstat/src/TMemStatMng.cxx +++ b/misc/memstat/src/TMemStatMng.cxx @@ -135,6 +135,39 @@ void TMemStatMng::Close() // TODO: This is a temporary solution until we find a properalgorithm for SaveData //fgInstance->fDumpFile->WriteObject(fgInstance->fFAddrsList, "FAddrsList"); +/* ofstream f("mem_stat_debug.txt"); + int *btids = fgInstance->fHbtids->GetArray(); + if( !btids ) + return; + int btid(1); + int count(0); + bool bStop(false); + int count_empty(0); + for (int i = 0; i < fgInstance->fBTChecksums.size(); ++i) + { + if (bStop) + break; + count = btids[btid-1]; + f << "++++++++++++++++++++++++\n"; + f << "BTID: " << btid << "\n"; + if ( count <= 0 ) + ++count_empty; + for (int j = btid+1; j <= (btid+count); ++j ) + { + TNamed *nm = (TNamed*)fgInstance->fFAddrsList->At(btids[j]); + if( !nm ) + { + f << "Bad ID" << endl; + bStop = true; + } + f << "-------> " << nm->GetTitle() << "\n"; + } + btid = btid + count + 1; + } + f.close(); + ::Info("TMemStatMng::Close", "btids without a stack %d\n", count_empty); +*/ + // to be documented fgInstance->FillTree(); fgInstance->Disable(); @@ -163,7 +196,7 @@ TMemStatMng::~TMemStatMng() Info("~TMemStatMng", ">>> All free/malloc calls count: %d", fBTIDCount); Info("~TMemStatMng", ">>> Unique BTIDs count: %zu", fBTChecksums.size()); - + Disable(); } @@ -309,7 +342,6 @@ Int_t TMemStatMng::generateBTID(UChar_t *CRCdigest, Int_t stackEntries, void **stackPointers) { // An internal function, which returns a bitid for a corresponding CRC digest - // cache variables static Int_t old_btid = -1; static SCustomDigest old_digest; @@ -409,7 +441,7 @@ void TMemStatMng::AddPointer(void *ptr, Int_t size) // for Debug. A counter of all (de)allacations. ++fBTIDCount; - Int_t btid(generateBTID(digest, stackentries, stptr)); + Int_t btid(generateBTID(digest, stackentries, stptr)); if(btid <= 0) Error("AddPointer", "bad BT id"); -- GitLab