73 if (!fname || strlen(fname) <5 || strstr(fname,
"*")) {
77 fname = strstr(s.
Data()+ns-25,
"memstat");
79 printf(
"Analyzing file: %s\n",fname);
82 printf(
"Cannot open file %s\n",fname);
87 printf(
"cannot find the TMemStat TTree named T in file %s\n",fname);
91 printf(
"Illegal update value %g, changed to 0.01\n",
update);
94 if (
update < 0.001)
printf(
"Warning update parameter is very small, processing may be slow\n");
99 Long64_t nsel = T->
Draw(
"pos:nbytes:time:btid",
"",
"goff");
112 imean = imean - imean%bw;
113 irms = irms -irms%bw;
117 if (ivmax > 2000000000 && ivmin <2000000000) {
121 printf(
"memory locations above 2GBytes will be ignored\n");
122 nsel = T->
Draw(
"pos:nbytes:time:btid",
"pos <2e9",
"goff");
130 imean = imean - imean%bw;
131 irms = irms -irms%bw;
132 nbins =
Int_t(4*irms/bw);
133 ivmin = imean -bw*nbins/2;
134 ivmax = ivmin+bw*
nbins;
140 memset(nbold,0,nvm*8);
142 h =
new TH1D(
"h",
Form(
"%s;pos;per cent of pages used",fname),nbins,ivmin,ivmax);
148 halloc =
new TH1D(
"halloc",
Form(
"%s;pos;number of mallocs",fname),nbins,ivmin,ivmax);
149 hfree =
new TH1D(
"hfree",
Form(
"%s;pos;number of frees",fname),nbins,ivmin,ivmax);
177 for (i=0;i<nsel;i++) {
183 if (bin<1 || bin>nbins)
continue;
187 if (dbin > nbytes) dbin = nbytes;
191 nb =
Int_t((nbytes-dbin)/dv);
192 if (bin+nb >nbins) nb = nbins-bin;
195 rest = nbytes-nb*dv-dbin;
198 if (nbold[ipos] > 0)
printf(
"reallocating %d bytes (was %lld) at %lld, entry=%d\n",nbytes,nbold[ipos],ipos,i);
199 if (nbold[ipos] == 0) {
204 nbold[ipos] = nbytes;
207 nbytes = nbold[ipos];
208 if (bin+nb >nbins) nb = nbins-bin;
209 nbold[ipos] = 0; nleaks--;
210 if (nbytes <= 0)
continue;
212 if (dbin > nbytes) dbin = nbytes;
215 nb =
Int_t((nbytes-dbin)/dv);
216 if (bin+nb >nbins) nb = nbins-bin;
219 rest = nbytes-nb*dv-dbin;
223 if (time -updateLast >
update) {
239 Double_t occupancy = mbytes/(nonEmpty*0.01*dv);
240 pvt->
AddText(
Form(
"memory used = %g Mbytes",mbytes*1e-6));
241 pvt->
AddText(
Form(
"page occupancy = %f per cent",occupancy));
242 pvt->
AddText(
"(for non empty pages only)");
250 Int_t nlmax = nleaks;
259 ileaks[nleaks] = (
Int_t)nbold[
ii];
260 entry[nleaks] = ientry[
ii];
262 if (nleaks > nlmax)
break;
267 hentry =
new TH1I(
"hentry",
"leak entry index",nleaks,0,nleaks);
268 hleaks =
new TH1I(
"hleaks",
"leaks;leak number;nbytes in leak",nleaks,0,nleaks);
269 for (
Int_t k=0;k<nleaks;k++) {
270 Int_t kk = lindex[k];
295 c2->
Connect(
"ProcessedEvent(Int_t, Int_t, Int_t, TObject*)",
296 0, 0,
"EventInfo(Int_t, Int_t, Int_t, TObject*)");
318 if (!btidlist) btidlist = (
TObjArray*)f->
Get(
"FAddrsList");
319 if (!btidlist)
return;
322 for (
Int_t i=0;i<nbt;i++) {
327 Int_t nch = strlen(title);
328 if (nch < 20)
continue;
329 if (nch > 100) title[100] =0;
330 const char *
bar = strstr(title,
"| ");
332 if (strstr(bar,
"operator new"))
continue;
333 if (strstr(bar,
"libMemStat"))
continue;
334 if (strstr(bar,
"G__Exception"))
continue;
virtual Double_t * GetV3()
virtual const char * GetTitle() const
Returns title of object.
virtual void SetGridx(Int_t value=1)
virtual Int_t Fill(Double_t x)
Increment bin with abscissa X by 1.
virtual Bool_t ProcessEvents()
Process pending events (GUI, timers, sockets).
virtual void Delete(Option_t *option="")
Remove all objects from the list AND delete all heap based objects.
virtual void Draw(Option_t *option="")
Draw this pavetext with its current attributes.
virtual Double_t GetBinContent(Int_t bin) const
Return content of bin number bin.
virtual void SetMaximum(Double_t maximum=-1111)
virtual Double_t * GetV4()
R__EXTERN TStyle * gStyle
virtual TString GetFromPipe(const char *command)
Execute command and return output in TString.
A ROOT file is a suite of consecutive data records (TKey instances) with a well defined format...
virtual TText * AddText(Double_t x1, Double_t y1, const char *label)
Add a new Text line to this pavetext at given coordinates.
virtual TObject * Get(const char *namecycle)
Return pointer to object identified by namecycle.
virtual void SetMinimum(Double_t minimum=-1111)
virtual TList * GetListOfLines() const
virtual TObject * FindObject(const char *name) const
Find an object in this list using its name.
static TFile * Open(const char *name, Option_t *option="", const char *ftitle="", Int_t compress=1, Int_t netopt=0)
Create / open a file.
const char * Data() const
Double_t RMS(Long64_t n, const T *a, const Double_t *w=0)
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString...
The TNamed class is the base class for all named ROOT classes.
virtual void AddBinContent(Int_t bin)
Increment bin content by 1.
void Sort(Index n, const Element *a, Index *index, Bool_t down=kTRUE)
Base class for several text objects.
virtual void SetNDC(Bool_t isNDC=kTRUE)
Set NDC mode on if isNDC = kTRUE, off otherwise.
virtual TList * GetUserInfo()
Return a pointer to the list containing user objects associated to this tree.
virtual void SetLabel(const char *label)
A Pave (see TPave) with a text centered in the Pave.
Bool_t Connect(const char *signal, const char *receiver_class, void *receiver, const char *slot)
Non-static method is used to connect from the signal of this object to the receiver slot...
virtual void SetRange(Int_t first=0, Int_t last=0)
Set the viewing range for the axis from bin first to last.
virtual void SetEstimate(Long64_t nentries=1000000)
Set number of entries to estimate variable limits.
Class to manage histogram axis.
R__EXTERN TSystem * gSystem
virtual void Draw(Option_t *option="")
Draw this histogram with options.
TPaveLabel title(3, 27.1, 15, 28.7,"ROOT Environment and Tools")
virtual void SetFillColor(Color_t fcolor)
virtual Double_t * GetV2()
virtual Double_t GetBinUpEdge(Int_t bin) const
Return up edge of bin.
1-D histogram with a int per channel (see TH1 documentation)}
virtual void SetBinContent(Int_t bin, Double_t content)
Set bin content see convention for numbering bins in TH1::GetBin In case the bin number is greater th...
Double_t Mean(Long64_t n, const T *a, const Double_t *w=0)
static void update(gsl_integration_workspace *workspace, double a1, double b1, double area1, double error1, double a2, double b2, double area2, double error2)
char * Form(const char *fmt,...)
1-D histogram with a double per channel (see TH1 documentation)}
virtual Int_t FindBin(Double_t x)
Find bin number corresponding to abscissa x.
TCanvasImp * GetCanvasImp() const
Get canvas implementation pointer if any.
A Pave (see TPave) with text, lines or/and boxes inside.
virtual void Draw(Option_t *option="")
Draw this pavelabel with its current attributes.
virtual void SetGridy(Int_t value=1)
ClassImp(TMCParticle) void TMCParticle printf(": p=(%7.3f,%7.3f,%9.3f) ;", fPx, fPy, fPz)
virtual void Draw(Option_t *opt)
Default Draw method for all objects.
Mother of all ROOT objects.
void EventInfo(Int_t event, Int_t px, Int_t py, TObject *selected)
void memstatExample(double update=0.01, const char *fname="*")
void SetOptStat(Int_t stat=1)
The type of information printed in the histogram statistics box can be selected via the parameter mod...
virtual TText * DrawText(Double_t x, Double_t y, const char *text)
Draw this text with new coordinates.
virtual void SetEntries(Double_t n)
virtual Long64_t GetEntries() const
A TTree object has a header with a name and a title.
void SetFrameFillColor(Color_t color=1)
virtual void SetTextSize(Float_t tsize=1)
TObject * At(Int_t idx) const
virtual void Update()
Update canvas pad buffers.
virtual Double_t * GetV1()
void Modified(Bool_t flag=1)
virtual void SetLogy(Int_t value=1)
Set Lin/Log scale for Y.