75 Printf(
" +++ TWrkInfo ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ");
78 Printf(
" +++ Amounts processed: %d packets (%d remote), %lld evts, %lld bytes",
85 Printf(
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ");
90 if (fStop < wi->
fStop) {
110 if (!strcmp(opt,
"S")) {
124 if (!strcmp(opt,
"R")) {
131 while ((o = nxp())) { o->
Print(
"S"); }
186 Printf(
" +++ TFileInfo ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ");
195 Printf(
" +++ MB rates: %f MB/s (avg), %f MB/s (min), %f MB/s (max)",
197 Printf(
" +++ Sizes: %lld (avg), %lld (min), %lld (max)",
200 Printf(
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ");
205 if (fStop < wi->
fStop) {
219 const char *title,
const char *treename)
220 :
TNamed(perffile, title), fFile(0), fTreeName(treename), fTree(0),
221 fInitTime(-1.), fMergeTime(-1.), fMaxTime(-1.),
222 fEvents(0), fPackets(0),
223 fEvtRateMax(-1.), fMBRateMax(-1.), fLatencyMax(-1.),
224 fEvtRate(0), fEvtRateRun(0), fMBRate(0), fMBRateRun(0),
225 fEvtRateAvgMax(-1.), fMBRateAvgMax(-1.),
226 fEvtRateAvg(-1.), fMBRateAvg(0),
227 fFileResult(
""), fSaveResult(
kFALSE),
231 if (!title)
SetTitle(
"PROOF Performance Analysis");
237 Error(
"TProofPerfAnalysis",
"problems opening file '%s'",
238 perffile ? perffile :
"<undef>");
257 Error(
"TProofPerfAnalysis",
"directory '%s' not found or not loadable",
fDirName.
Data());
291 :
TNamed(
"", title), fFile(0), fTree(0),
292 fInitTime(-1.), fMergeTime(-1.), fMaxTime(-1.),
293 fEvents(0), fPackets(0),
294 fEvtRateMax(-1.), fMBRateMax(-1.), fLatencyMax(-1.),
295 fEvtRate(0), fEvtRateRun(0), fMBRate(0), fMBRateRun(0),
296 fEvtRateAvgMax(-1.), fMBRateAvgMax(-1.),
297 fEvtRateAvg(-1.), fMBRateAvg(0),
307 if (!title)
SetTitle(
"PROOF Performance Analysis");
349 if (t && strlen(t) > 0) {
376 while ((k = (
TKey *) nxk())) {
404 Error(
"FileDist",
"not a valid instance - do nothing");
412 Info(
"FileDist",
"%d workers were active during this query", wrkList->
GetSize());
413 Info(
"FileDist",
"%d servers were active during this query", srvList->
GetSize());
419 while ((sn = (
TNamed *)nxs())) {
421 while ((wn = (
TNamed *) nxw())) {
432 while ((wn = (
TNamed *) nxw())) {
435 while ((nwn = (
TNamed *) nnxw())) {
441 if (!nwn) nwl->
Add(wn);
444 while ((sn = (
TNamed *)nxs())) {
445 if (!strcmp(sn->
GetTitle(), wn->GetName())) {
448 while ((nsn = (
TNamed *) nnxs())) {
454 if (!nsn) nsl->
Add(sn);
458 if (sn) srvList->
Remove(sn);
462 while ((sn = (
TNamed *)nxs())) {
480 Printf(
"\n +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ");
481 Printf(
" + Only one data server found: full analysis meaningful + ");
482 Printf(
" + only when there are more file servers + ");
483 Printf(
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ \n");
487 TH1F *hxpak =
new TH1F(
"hxpak",
"MBytes / Worker",
496 while ((wn = (
TNamed *)nxsw())) {
513 TH1F *hfdis =
new TH1F(
"hfdis",
"Packet dist",
518 TH1F *hbdis =
new TH1F(
"hbdis",
"MBytes dist",
524 TH2F *hxpak =
new TH2F(
"hxpak",
"MBytes / {Worker,Server}",
536 while ((wn = (
TNamed *)nxsw())) {
541 while ((sn = (
TNamed *)nxss())) {
552 while ((sn = (
TNamed *)nxss())) {
588 if (!wl || !sl)
return;
596 for (
Long64_t k=0; k<entries; k++) {
629 TString o1(ord1), o2(ord2), p1, p2;
630 Int_t o1d = 0, o2d = 0;
631 if ((o1d = o1.CountChar(
'.')) > (o2d = o2.CountChar(
'.'))) {
633 }
else if (o1d < o2d) {
636 o1.ReplaceAll(
".",
" ");
637 o2.ReplaceAll(
".",
" ");
638 Bool_t b1 = o1.Tokenize(p1, o1d,
" ");
639 Bool_t b2 = o2.Tokenize(p2, o2d,
" ");
646 b1 = o1.Tokenize(p1, o1d,
" ");
647 b2 = o2.Tokenize(p2, o2d,
" ");
652 }
else if (b2 && !b1) {
665 if (!hf || !hb || !hx)
return;
671 if (!(fout = fopen(fnout.
Data(),
"w"))) {
672 Warning(
"FillFileDist",
"asked to save details in '%s' but file could"
673 " not be open (errno: %d)", fnout.
Data(), (
int)errno);
675 Info(
"FillFileDist",
"saving details to '%s'", fnout.
Data());
683 for (
Long64_t k=0; k<entries; k++) {
699 fprintf(fout,
"%s,%s -> %f,%f (%f)\n",
706 if (fout) fclose(fout);
722 if (!(fout = fopen(fnout.
Data(),
"w"))) {
723 Warning(
"FillFileDistOneSrv",
"asked to save details in '%s' but file could"
724 " not be open (errno: %d)", fnout.
Data(), (
int)errno);
726 Info(
"FillFileDistOneSrv",
"saving details to '%s'", fnout.
Data());
734 for (
Long64_t k=0; k<entries; k++) {
748 fprintf(fout,
"%s,%s -> %f (%f)\n",
753 if (fout) fclose(fout);
764 Error(
"WorkerActivity",
"not a valid instance - do nothing");
771 Error(
"WorkerActivity",
"workers information not available - do nothing");
780 if (
t1 > t0)
t1 = t0;
781 TH1F *hact10 =
new TH1F(
"act10",
"Worker activity start (seconds)", 50, 0.,
t1);
784 TH1F *hact11 =
new TH1F(
"act11",
"Worker activity stop (seconds)", 50, t0,
fMaxTime);
787 TH1F *hact2 =
new TH1F(
"act2",
"End of activity (seconds)", 50, t0,
fMaxTime);
799 for (j = 1; j < hact10->
GetNbinsX()+1 ; j++) {
803 for (j = 1; j < hact11->
GetNbinsX()+1 ; j++) {
847 if (showlast < 0 || k < showlast) wi->
Print();
858 if (!wn || (wn && strlen(wn) <= 0)) {
859 Error(
"PrintWrkInfo",
"worker name or host must be defined!");
874 while (ww.Tokenize(w, from,
"[, ]")) {
898 if (showlast < 0 || k < showlast) fi->
Print(opt);
911 if (!fn || (fn && strlen(fn) <= 0)) {
912 Error(
"PrintFileInfo",
"file path must be defined!");
930 while (fw.Tokenize(
f, from,
"[, ]")) {
966 Int_t nraw = entries * 2, jj = 0, kk = 0;
968 for (
Long64_t k=0; k<entries; k++) {
981 memset(jidx, 0, nbins *
sizeof(
Int_t));
985 for (kk = 0; kk < nbins; kk++) {
987 if (jj == 0 || xtmp > xbins[jj - 1] + .5) {
997 Int_t nbin = nbins - 1;
1000 fEvtRate =
new TH1F(
"gEvtRate",
"Total event processing rate (evt/s)", nbin, xbins);
1006 fEvtRateRun =
new TH1F(
"gEvtRateAvg",
"Event processing rate running average (evt/s)", nbin, xbins);
1012 fMBRate =
new TH1F(
"gMBRate",
"Total processing rate (MB/s)", nbin, xbins);
1018 fMBRateRun =
new TH1F(
"gMBRateAvg",
"Processing rate running average (MB/s)", nbin, xbins);
1027 TList *gwl = 0, *gbl = 0;
1031 for (
Long64_t k=0; k<entries; k++) {
1078 for (kk = 1; kk <= nbins; kk++) {
1080 if (mi > stop)
break;
1086 if (start > mi) olap = mx - start;
1106 Printf(
" +++ %s #:%d at:%fs lat:%fs proc:%fs evts:%lld bytes:%lld (rates:%f evt/s, %f MB/s)",
1111 Printf(
" +++ %s #:%d at:%fs lat:%fs proc:%fs rate:-- evt/s (-- bytes/s)",
1128 while ((gbl = (
TList *) nxb())) {
1131 while ((gwl = (
TList *) nxw())) {
1154 for (kk = 1; kk < nbins; kk++) {
1185 while ((wi = (
TWrkInfo *) nxw())) {
1202 while ((wi = (
TWrkInfo *) nxsw())) {
1203 if (wi->
fStop > 0.) ksw++;
1204 if (ksw == rsw)
break;
1217 while ((wi = (
TWrkInfo *)nxwi())) {
1251 if (!strcmp(opt,
"S")) {
1253 Printf(
"%d %f %f %f %f %f %f %f",
1259 Printf(
" +++ Total query time: %f secs (init: %f secs, merge: %f secs)",
1287 for (
Long64_t k=0; k<entries; k++) {
1354 Printf(
" +++ %s #:%d at:%fs lat:%fs proc:%fs evts:%lld bytes:%lld (rates:%f evt/s, %f MB/s)",
1359 Printf(
" +++ %s #:%d at:%fs lat:%fs proc:%fs rate:-- evt/s (-- bytes/s)",
1413 if (
f && !
f->IsZombie()) {
1436 Printf(
"Drawn objects saving disabled");
1451 if (!
f ||
f->IsZombie()) {
1454 Error(
"SetSaveResult",
"could not open file '%s' in mode '%s'",
file, mode);
1465 Printf(
"Drawn objects will be saved in file '%s'",
file);
1482 Error(
"EventDist",
"distributions not initialized - do nothing");
1508 TH1F *hrt1 = 0, *hrt2 = 0;
1516 hrt1 =
new TH1F(
"rt1",
"Evt processing rate (evt/s)", 100, 0.,
fMaxTime);
1522 hrt2 =
new TH1F(
"rt2",
"MB processing rate (MB/s)", 100, 0.,
fMaxTime);
1523 hrt2->SetMinimum(0.);
1526 hrt2->GetXaxis()->SetTitle(
"Query Processing Time (s)");
1549 if (!ww.
IsNull() && ww !=
"*" && ww !=
"all") {
1552 while ((ww.
Tokenize(w, from,
","))) {
1559 Int_t ci = 40, cir = 30, ic = 0;
1562 while ((wi = (
TWrkInfo *) nxw())) {
1610 TH1F *hlt1 =
new TH1F(
"lt1",
"Packet retrieval latency", 100, 0.,
fMaxTime);
1626 if (!ww.
IsNull() && ww !=
"*" && ww !=
"all") {
1629 while ((ww.
Tokenize(w, from,
","))) {
1636 Int_t ci = 40, ic = 0;
1639 while ((wi = (
TWrkInfo *) nxw())) {
1664 if (!fn || strlen(fn) <= 0) {
1665 Error(
"FileRatePlot",
"file name is mandatory!");
1671 Error(
"FileRatePlot",
"TFileInfo object for '%s' not found!", fn);
1677 if (out && strlen(out) > 0) {
1678 if (!(fo = fopen(out,
"w"))) {
1679 Warning(
"FileRatePlot",
"problems creating '%s': logging to stdout", out);
1682 Printf(
" Details logged to %s", out);
1695 xraw[jj++] = pi->
fStop;
1698 memset(jidx, 0, nbins *
sizeof(
Int_t));
1702 for (kk = 0; kk < nbins; kk++) {
1703 xbins[kk] = xraw[jidx[kk]];
1709 Int_t nbin = nbins - 1;
1712 TH1F *hrt1 =
new TH1F(
"rt1",
"Total processing rate (MB/s)", nbins - 1, xbins);
1717 TH1F *hrt2 =
new TH1F(
"rt2",
"Number of processing workers", nbins - 1, xbins);
1723 TH1F *hrt3 =
new TH1F(
"rt3",
"Total processing events", nbins - 1, xbins);
1728 TH1F *hrt4 =
new TH1F(
"rt4",
"Weighted processing rate (MB/s)", nbins - 1, xbins);
1737 for (ii = 1; ii <= nbin; ii++) {
1742 fprintf(fo,
" Bin: %d/%d [%f, %f]\n", ii, nbin, mi, mx);
1755 fprintf(fo,
" %d: %s \t%lld \tevts \t%f \tMB/s\n", kk++, pi->
GetName(), pi->
fSize, pi->
fMBRate);
1759 if (fo != stdout) fclose(fo);
1786 TH1F *hrt1 =
new TH1F(
"rt1",
"Event processing rate per packet (evt/s)", 100, 0.,
fMaxTime);
1792 TH1F *hrt2 =
new TH1F(
"rt2",
"I/O processing rate per packet (MB/s)", 100, 0.,
fMaxTime);
1813 if (!fw.
IsNull() && fw !=
"*" && fw !=
"all") {
1816 while ((fw.
Tokenize(w, from,
","))) {
1823 Int_t ci = 40, cir = 30, ic = 0;
void Printf(const char *fmt,...)
R__EXTERN TStyle * gStyle
R__EXTERN TSystem * gSystem
virtual void SetTitleOffset(Float_t offset=1)
Set distance between the axis and the axis title.
virtual void SetFillColor(Color_t fcolor)
Set the fill area color.
virtual void SetLineColor(Color_t lcolor)
Set the line color.
virtual void SetBinLabel(Int_t bin, const char *label)
Set label for bin.
virtual Double_t GetBinCenter(Int_t bin) const
Return center of bin.
virtual Int_t FindBin(Double_t x)
Find bin number corresponding to abscissa x.
virtual void ls(Option_t *option="") const
List (ls) all objects in this collection.
virtual void Print(Option_t *option="") const
Default print for collections, calls Print(option, 1).
void SetName(const char *name)
virtual void SetOwner(Bool_t enable=kTRUE)
Set whether this collection is the owner (enable==true) of its content.
virtual Int_t GetSize() const
Return the capacity of the collection, i.e.
TObject * Get(const char *namecycle) override
Return pointer to object identified by namecycle.
Describe directory structure in memory.
virtual void Close(Option_t *option="")
Delete all objects from memory and directory structure itself.
virtual TObject * Get(const char *namecycle)
Return pointer to object identified by namecycle.
virtual TList * GetListOfKeys() const
A ROOT file is a suite of consecutive data records (TKey instances) with a well defined format.
static TFile * Open(const char *name, Option_t *option="", const char *ftitle="", Int_t compress=ROOT::RCompressionSetting::EDefaults::kUseCompiledDefault, Int_t netopt=0)
Create / open a file.
void Close(Option_t *option="") override
Close a file.
A TGraph is an object made of two arrays X and Y with npoints each.
virtual void SetPoint(Int_t i, Double_t x, Double_t y)
Set x and y values for point number i.
virtual void SetNameTitle(const char *name="", const char *title="")
Set graph name and title.
virtual void Set(Int_t n)
Set number of points in the graph Existing coordinates are preserved New coordinates above fNpoints a...
1-D histogram with a float per channel (see TH1 documentation)}
virtual void SetDirectory(TDirectory *dir)
By default, when a histogram is created, it is added to the list of histogram objects in the current ...
virtual Double_t GetBinCenter(Int_t bin) const
Return bin center for 1D histogram.
TAxis * GetXaxis()
Get the behaviour adopted by the object about the statoverflows. See EStatOverflows for more informat...
virtual Int_t GetNbinsX() const
virtual void SetMaximum(Double_t maximum=-1111)
virtual Int_t Fill(Double_t x)
Increment bin with abscissa X by 1.
virtual void SetMinimum(Double_t minimum=-1111)
virtual Double_t GetBinLowEdge(Int_t bin) const
Return bin lower edge for 1D histogram.
virtual void Draw(Option_t *option="")
Draw this histogram with options.
virtual Double_t GetBinContent(Int_t bin) const
Return content of bin number bin.
virtual Double_t GetBinWidth(Int_t bin) const
Return bin width for 1D histogram.
virtual Bool_t Divide(TF1 *f1, Double_t c1=1)
Performs the operation: this = this/(c1*f1) if errors are defined (see TH1::Sumw2),...
virtual void SetStats(Bool_t stats=kTRUE)
Set statistics option on/off.
2-D histogram with a float per channel (see TH1 documentation)}
Int_t Fill(Double_t)
Invalid Fill method.
THashList implements a hybrid collection class consisting of a hash table and a list to store TObject...
TObject * FindObject(const char *name) const
Find object using its name.
Book space in a file, create I/O buffers, to fill them, (un)compress them.
virtual const char * GetClassName() const
virtual void Add(TObject *obj)
virtual TObject * Remove(TObject *obj)
Remove object from the list.
virtual TObject * FindObject(const char *name) const
Find an object in this list using its name.
virtual void AddBefore(const TObject *before, TObject *obj)
Insert object before object before in the list.
virtual void Clear(Option_t *option="")
Remove all objects from the list.
The TNamed class is the base class for all named ROOT classes.
virtual void SetTitle(const char *title="")
Set the title of the TNamed.
virtual void SetName(const char *name)
Set the name of the TNamed.
virtual const char * GetTitle() const
Returns title of object.
virtual const char * GetName() const
Returns name of object.
Collectable string class.
Mother of all ROOT objects.
virtual Int_t Write(const char *name=0, Int_t option=0, Int_t bufsize=0)
Write this object to the current directory.
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.
virtual TObject * FindObject(const char *name) const
Must be redefined in derived classes.
R__ALWAYS_INLINE Bool_t IsZombie() const
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
virtual void Draw(Option_t *option="")
Default Draw method for all objects.
virtual void Print(Option_t *option="") const
This method must be overridden when a class wants to print itself.
@ kInvalidObject
if object ctor succeeded but object should not be used
virtual void Info(const char *method, const char *msgfmt,...) const
Issue info message.
The most important graphics class in the ROOT system.
void Divide(Int_t nx=1, Int_t ny=1, Float_t xmargin=0.01, Float_t ymargin=0.01, Int_t color=0) override
Automatic pad generation by division.
TVirtualPad * cd(Int_t subpadnumber=0) override
Set Current pad.
TVirtualPad * GetPad(Int_t subpadnumber) const override
Get a pointer to subpadnumber of this pad.
TVirtualPerfStats::EEventType fType
Long64_t fEventsProcessed
Int_t Compare(const TObject *o) const
Compare two TNamed objects.
void Print(Option_t *opt="") const
Print TNamed name and title.
TFileInfo(const char *name, const char *srv)
TPackInfo(const char *ord, const char *host)
void Print(Option_t *opt="") const
Print TNamed name and title.
TPackInfo(const char *ord, const char *host, Float_t start, Float_t stop, Long64_t sz, Double_t mbr)
void Print(Option_t *="") const
This method must be overridden when a class wants to print itself.
TWrkEntry(Double_t xx, Double_t er, Double_t mbr, Double_t pt)
void Print(Option_t *opt="") const
Print TNamed name and title.
TWrkInfoFile(const char *ord, const char *name)
Long64_t fEventsProcessed
void Print(Option_t *="") const
Print TNamed name and title.
Int_t Compare(const TObject *o) const
Compare two TNamed objects.
TWrkInfo(const char *ord, const char *name)
void FileRatePlot(const char *fns=0)
Show MB processing rate plot per file vs time.
void FileProcPlot(const char *fn, const char *out=0)
Show event processing or MB processing rate plot vs time.
void FillFileInfo(Bool_t force=kFALSE)
Fill basic worker info; if 'force' rescan the TTree even already done.
void SetDebug(Int_t d=0)
Static setter for the verbosity level.
TProofPerfAnalysis(const char *perffile, const char *title="", const char *treename="PROOF_PerfStats")
Constructor: open the file and attach to the tree.
void PrintWrkInfo(Int_t showlast=10)
Print information for all or the slowest showlast workers.
void LatencyPlot(const char *wrks=0)
Show event processing or MB processing rate plot vs time Create the histograms.
void WorkerActivity()
Measure the worker activity.
void FileDist(Bool_t writedet=kFALSE)
Analyse the file distribution.
Int_t SetSaveResult(const char *file="results.root", Option_t *mode="RECREATE")
Set save result mode and validate 'file' according to 'mode'.
void GetWrkFileList(TList *wl, TList *sl)
Fill file info.
void EventDist()
Display event and packet distribution.
TString GetCanvasTitle(const char *t)
If defined, add '- <this title>' to the canvas title 't'.
static void SetgDebug(Bool_t on=kTRUE)
Static setter for the verbosity level.
Int_t CompareOrd(const char *ord1, const char *ord2)
Return -1 if ord1 comes before ord2, 0 i they are equal, 1 if ord1 comes after ord2.
void LoadTree(TDirectory *dir)
Load tree fTreeName from directory 'dir'.
void DoDraw(TObject *o, Option_t *opt="", const char *name=0)
Draw object 'o' with options 'opt' Save it with 'name' if in saving mode (see SetSaveResult)
void PrintFileInfo(Int_t showlast=10, const char *opt="", const char *out=0)
Print information for all or the slowest showlast workers.
void FillFileDistOneSrv(TH1F *hx, Bool_t wdet=kFALSE)
Fill file info when there is only one file server.
void FillWrkInfo(Bool_t force=kFALSE)
Fill basic worker info; if 'force' rescan the TTree even already done.
virtual ~TProofPerfAnalysis()
Destructor: detach the tree and close the file.
void Summary(Option_t *opt="", const char *out="")
Print summary of query.
void RatePlot(const char *wrks=0)
Show event processing or MB processing rate plot vs time.
void FillFileDist(TH1F *hf, TH1F *hb, TH2F *hx, Bool_t wdet=kFALSE)
Fill file info.
Regular expression class.
void Add(TObject *obj)
Add object in sorted list.
Int_t Atoi() const
Return integer value of string.
TString & Replace(Ssiz_t pos, Ssiz_t n, const char *s)
const char * Data() const
TObjArray * Tokenize(const TString &delim) const
This function is used to isolate sequential tokens in a TString.
Bool_t BeginsWith(const char *s, ECaseCompare cmp=kExact) const
TString & Remove(Ssiz_t pos)
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString.
void Form(const char *fmt,...)
Formats a string using a printf style format descriptor.
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
Ssiz_t Index(const char *pat, Ssiz_t i=0, ECaseCompare cmp=kExact) const
void SetOptStat(Int_t stat=1)
The type of information printed in the histogram statistics box can be selected via the parameter mod...
virtual Int_t RedirectOutput(const char *name, const char *mode="a", RedirectHandle_t *h=nullptr)
Redirect standard output (stdout, stderr) to the specified file.
virtual const char * BaseName(const char *pathname)
Base name of a file name. Base name of /user/root is root.
virtual TString GetDirName(const char *pathname)
Return the directory name in pathname.
A TTree represents a columnar dataset.
virtual Int_t GetEntry(Long64_t entry, Int_t getall=0)
Read all branches of entry and return total number of bytes read.
virtual Int_t SetBranchAddress(const char *bname, void *add, TBranch **ptr=0)
Change branch address, dealing with clone trees properly.
virtual Long64_t GetEntries() const
This class represents a WWW compatible URL.
const char * GetUrl(Bool_t withDeflt=kFALSE) const
Return full URL.
const char * GetFile() const
const char * GetHost() const
const char * GetHostFQDN() const
Return fully qualified domain name of url host.
void Draw(Option_t *option="") override=0
Default Draw method for all objects.
void Sort(Index n, const Element *a, Index *index, Bool_t down=kTRUE)