X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;f=STEER%2FAliMemoryWatcher.cxx;h=5cfcc7e5c004ef588fe63cd7405bd077379cddec;hb=7207d8328c168c9c73033203e089edb74c0f4161;hp=96389b696ca7b1490fa5af503d22cda8142441b0;hpb=65f03c13be9c89f7313842c8d9027f833b0b2aef;p=u%2Fmrichter%2FAliRoot.git diff --git a/STEER/AliMemoryWatcher.cxx b/STEER/AliMemoryWatcher.cxx index 96389b696ca..5cfcc7e5c00 100644 --- a/STEER/AliMemoryWatcher.cxx +++ b/STEER/AliMemoryWatcher.cxx @@ -43,13 +43,14 @@ // by how much your program is leaking. //*-- Author: Laurent Aphecetche(SUBATECH) // --- std system --- -class assert ; +#include #ifdef __APPLE__ #include #else #include #endif // --- AliRoot header files --- +#include "AliLog.h" #include "AliMemoryWatcher.h" // --- ROOT system --- #include "TSystem.h" @@ -61,38 +62,43 @@ class assert ; ClassImp(AliMemoryWatcher) //_____________________________________________________________________________ -AliMemoryWatcher::AliMemoryWatcher(UInt_t maxsize) +AliMemoryWatcher::AliMemoryWatcher(UInt_t maxsize) : + TObject(), + fUseMallinfo(kTRUE), + fPID(gSystem->GetPid()), + fMAXSIZE(maxsize), + fSize(0), + fX(new Int_t[fMAXSIZE]), + fVSIZE(new Int_t[fMAXSIZE]), + fRSSIZE(new Int_t[fMAXSIZE]), + fTIME(new Double_t[fMAXSIZE]), + fTimer(0), + fDisabled(kFALSE) { + // //ctor - fMAXSIZE=maxsize; - fUseMallinfo = true; - fPID = gSystem->GetPid(); - sprintf(fCmd,"ps -h -p %d -o vsize,rssize",fPID); - fX = new Int_t[fMAXSIZE]; - fVSIZE = new Int_t[fMAXSIZE]; - fRSSIZE = new Int_t[fMAXSIZE]; - fTIME = new Double_t[fMAXSIZE]; - fSize=0; - fDisabled=false; - fTimer=0; + // + sprintf(fCmd,"ps -h -p %d -o vsz,rss | grep -v VSZ",fPID); } + //_____________________________________________________________________________ AliMemoryWatcher::AliMemoryWatcher(const AliMemoryWatcher& mw): - TObject(mw) + TObject(mw), + fUseMallinfo(mw.fUseMallinfo), + fPID(mw.fPID), + fMAXSIZE(mw.fMAXSIZE), + fSize(0), + fX(new Int_t[fMAXSIZE]), + fVSIZE(new Int_t[fMAXSIZE]), + fRSSIZE(new Int_t[fMAXSIZE]), + fTIME(new Double_t[fMAXSIZE]), + fTimer(0), + fDisabled(kFALSE) { //copy ctor - fMAXSIZE = mw.fMAXSIZE ; - fUseMallinfo = mw.fUseMallinfo; - fPID = mw.fPID ; strcpy(fCmd, mw.fCmd) ; - fX = new Int_t[fMAXSIZE]; - fVSIZE = new Int_t[fMAXSIZE]; - fRSSIZE = new Int_t[fMAXSIZE]; - fTIME = new Double_t[fMAXSIZE]; - fSize=0; - fDisabled=false; - fTimer=0; } + //_____________________________________________________________________________ AliMemoryWatcher::~AliMemoryWatcher() { @@ -124,7 +130,7 @@ void AliMemoryWatcher::Watch(Int_t x) fTIME[fSize] = fTimer->CpuTime(); fSize++; #else - ::Fatal("Watch","Please SetUseMallinfo to kFALSE on this system"); + AliFatal("Please SetUseMallinfo to kFALSE on this system"); #endif } else { static Int_t vsize, rssize; @@ -146,7 +152,7 @@ void AliMemoryWatcher::Watch(Int_t x) } else { fDisabled=true; - Error("watch", "I'm full !" ) ; + AliError("I'm full !" ) ; } } //_____________________________________________________________________________ @@ -220,7 +226,7 @@ AliMemoryWatcher::Frame(void) const } //_____________________________________________________________________________ Int_t -AliMemoryWatcher::Write(const char *, Int_t, Int_t) +AliMemoryWatcher::WriteToFile() { // Stores the graphs in a file if ( GraphVSIZE() ) GraphVSIZE()->Write("VSIZE",TObject::kOverwrite);