Logo ROOT  
Reference Guide
TProofPerfAnalysis.h
Go to the documentation of this file.
1 // @(#)root/proofx:$Id$
2 // Author: G.Ganis Nov 2011
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2005, Rene Brun and Fons Rademakers. *
6  * All rights reserved. *
7  * *
8  * For the licensing terms see $ROOTSYS/LICENSE. *
9  * For the list of contributors see $ROOTSYS/README/CREDITS. *
10  *************************************************************************/
11 
12 #ifndef ROOT_TProofPerfAnalysis
13 #define ROOT_TProofPerfAnalysis
14 
15 //////////////////////////////////////////////////////////////////////////
16 // //
17 // TProofPerfAnalysis //
18 // //
19 // Set of tools to analyse the performance tree //
20 // //
21 //////////////////////////////////////////////////////////////////////////
22 
23 #include "TNamed.h"
24 #include "TSortedList.h"
25 #include "TString.h"
26 
27 class TFile;
28 class TH1F;
29 class TH2F;
30 class TList;
31 class TTree;
32 class TProofPerfAnalysis : public TNamed {
33 
34 public: // public because of Sun CC bug
35  class TFileInfo;
36  class TPackInfo;
37  class TWrkEntry;
38  class TWrkInfo;
39  class TWrkInfoFile;
40 
41 private:
42  TFile *fFile; // The open performance file
43  TString fDirName; // The name of the subdir with the perfomance tree
44  TString fTreeName; // The name of the performance tree
45  TTree *fTree; // The performance tree
46  TSortedList fWrksInfo; // Sorted list of workers info
47  TSortedList fFilesInfo; // Sorted list of files info
48  Float_t fInitTime; // End of initialization time for this query
49  Float_t fMergeTime; // Begin of merging time for this query
50  Float_t fMaxTime; // Max time for this query (slowest worker)
51  TH1F *fEvents; // Event distribution per worker
52  TH1F *fPackets; // Packet distribution per worker
53  Double_t fEvtRateMax; // Max event processing rate per packet
54  Double_t fMBRateMax; // Max MB processing rate per packet
55  Double_t fLatencyMax; // Max retrieval latency per packet
56  TH1F *fEvtRate; // Event processing rate vs query time
57  TH1F *fEvtRateRun; // Event processing rate running avg vs query time
58  TH1F *fMBRate; // Byte processing rate vs query time
59  TH1F *fMBRateRun; // Byte processing rate running avg vs query time
60  Double_t fEvtRateAvgMax; // Max running event processing rate
61  Double_t fMBRateAvgMax; // Max running MB processing rate
62  Double_t fEvtRateAvg; // Average event processing rate
63  Double_t fMBRateAvg; // Average MB processing rate
64  TString fFileResult; // File where to save basics of a run when requested
65  Bool_t fSaveResult; // Whether to save the results of a run
66 
67  Int_t fDebug; // Local verbosity level
68 
69  static Bool_t fgDebug; // Global verbosity on/off
70 
71  Int_t CompareOrd(const char *ord1, const char *ord2);
72  void FillFileDist(TH1F *hf, TH1F *hb, TH2F *hx, Bool_t wdet = kFALSE);
73  void FillFileDistOneSrv(TH1F *hx, Bool_t wdet = kFALSE);
74  void FillWrkInfo(Bool_t force = kFALSE);
75  void FillFileInfo(Bool_t force = kFALSE);
76  TString GetCanvasTitle(const char *t);
77  void GetWrkFileList(TList *wl, TList *sl);
78  void LoadTree(TDirectory *dir);
79  void DoDraw(TObject *o, Option_t *opt = "", const char *name = 0);
80 
81 public:
82 
83  TProofPerfAnalysis(const char *perffile, const char *title = "",
84  const char *treename = "PROOF_PerfStats");
85  TProofPerfAnalysis(TTree *tree, const char *title = "");
86  virtual ~TProofPerfAnalysis();
87 
88  Bool_t IsValid() const { return (fFile && fTree) ? kTRUE : kFALSE; }
89  Bool_t WrkInfoOK() const { return (fWrksInfo.GetSize() > 0) ? kTRUE : kFALSE; }
90 
91  void EventDist(); // Analyse event and packet distribution
92  void FileDist(Bool_t writedet = kFALSE); // Analyse the file distribution
93  void LatencyPlot(const char *wrks = 0); // Packet latency distribution vs time
94  void RatePlot(const char *wrks = 0); // Rate distribution vs time
95  void WorkerActivity(); // Analyse the worker activity
96  void PrintWrkInfo(Int_t showlast = 10); // Print workers info
97  void PrintWrkInfo(const char *wrk); // Print worker info by name
98 
99  void PrintFileInfo(Int_t showlast = 10, const char *opt = "", const char *out = 0); // Print file info
100  void PrintFileInfo(const char *fn, const char *opt = "P", const char *out = 0); // Print file info by name
101  void FileProcPlot(const char *fn, const char *out = 0); // Plot info about file processing
102  void FileRatePlot(const char *fns = 0); // Plot info about file processing rates
103 
104  Double_t GetEvtRateAvgMax() const { return fEvtRateAvgMax; } // Max running event processing rate
105  Double_t GetMBRateAvgMax() const { return fMBRateAvgMax; } // Max running MB processing rate
106  Double_t GetEvtRateAvg() const { return fEvtRateAvg; } // Average event processing rate
107  Double_t GetMBRateAvg() const { return fMBRateAvg; } // Average MB processing rate
108  void GetAverages(Double_t &evtmax, Double_t &mbmax, Double_t &evt, Double_t &mb) const
109  { evtmax = fEvtRateAvgMax; mbmax = fMBRateAvgMax; evt = fEvtRateAvg; mb = fMBRateAvg; return; }
110 
111  void Summary(Option_t *opt = "", const char *out = "");
112 
113  Int_t SetSaveResult(const char *file = "results.root", Option_t *mode = "RECREATE");
114 
115  void SetDebug(Int_t d = 0); // Setter for the verbosity level
116  static void SetgDebug(Bool_t on = kTRUE); // Overall verbosity level
117 
118  ClassDef(TProofPerfAnalysis, 0) // Set of tools to analyse the performance tree
119 };
120 
121 #endif
TProofPerfAnalysis::Summary
void Summary(Option_t *opt="", const char *out="")
Print summary of query.
Definition: TProofPerfAnalysis.cxx:1240
TProofPerfAnalysis::fFilesInfo
TSortedList fFilesInfo
Definition: TProofPerfAnalysis.h:47
TProofPerfAnalysis::TWrkInfoFile
Definition: TProofPerfAnalysis.cxx:118
TProofPerfAnalysis::fEvtRateAvg
Double_t fEvtRateAvg
Definition: TProofPerfAnalysis.h:62
kTRUE
const Bool_t kTRUE
Definition: RtypesCore.h:100
TProofPerfAnalysis::TProofPerfAnalysis
TProofPerfAnalysis(const char *perffile, const char *title="", const char *treename="PROOF_PerfStats")
Constructor: open the file and attach to the tree.
Definition: TProofPerfAnalysis.cxx:218
TProofPerfAnalysis::fEvtRate
TH1F * fEvtRate
Definition: TProofPerfAnalysis.h:56
Option_t
const char Option_t
Definition: RtypesCore.h:66
TH2F
2-D histogram with a float per channel (see TH1 documentation)}
Definition: TH2.h:251
tree
Definition: tree.py:1
TProofPerfAnalysis::FillWrkInfo
void FillWrkInfo(Bool_t force=kFALSE)
Fill basic worker info; if 'force' rescan the TTree even already done.
Definition: TProofPerfAnalysis.cxx:943
TProofPerfAnalysis::FileRatePlot
void FileRatePlot(const char *fns=0)
Show MB processing rate plot per file vs time.
Definition: TProofPerfAnalysis.cxx:1781
TProofPerfAnalysis::fgDebug
static Bool_t fgDebug
Definition: TProofPerfAnalysis.h:69
TProofPerfAnalysis::fSaveResult
Bool_t fSaveResult
Definition: TProofPerfAnalysis.h:65
TNamed.h
TProofPerfAnalysis::DoDraw
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)
Definition: TProofPerfAnalysis.cxx:1403
TTree
A TTree represents a columnar dataset.
Definition: TTree.h:79
TProofPerfAnalysis::fDirName
TString fDirName
Definition: TProofPerfAnalysis.h:43
Float_t
float Float_t
Definition: RtypesCore.h:57
TProofPerfAnalysis::fEvents
TH1F * fEvents
Definition: TProofPerfAnalysis.h:51
TProofPerfAnalysis::GetCanvasTitle
TString GetCanvasTitle(const char *t)
If defined, add '- <this title>' to the canvas title 't'.
Definition: TProofPerfAnalysis.cxx:344
Int_t
int Int_t
Definition: RtypesCore.h:45
TProofPerfAnalysis::fTree
TTree * fTree
Definition: TProofPerfAnalysis.h:45
TProofPerfAnalysis::fMBRateAvg
Double_t fMBRateAvg
Definition: TProofPerfAnalysis.h:63
TProofPerfAnalysis::FillFileDist
void FillFileDist(TH1F *hf, TH1F *hb, TH2F *hx, Bool_t wdet=kFALSE)
Fill file info.
Definition: TProofPerfAnalysis.cxx:663
TProofPerfAnalysis::fMaxTime
Float_t fMaxTime
Definition: TProofPerfAnalysis.h:50
TProofPerfAnalysis::CompareOrd
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.
Definition: TProofPerfAnalysis.cxx:627
TString
Basic string class.
Definition: TString.h:136
Bool_t
bool Bool_t
Definition: RtypesCore.h:63
TProofPerfAnalysis::fPackets
TH1F * fPackets
Definition: TProofPerfAnalysis.h:52
TString.h
TProofPerfAnalysis::~TProofPerfAnalysis
virtual ~TProofPerfAnalysis()
Destructor: detach the tree and close the file.
Definition: TProofPerfAnalysis.cxx:333
TProofPerfAnalysis::fEvtRateAvgMax
Double_t fEvtRateAvgMax
Definition: TProofPerfAnalysis.h:60
bool
TProofPerfAnalysis::WrkInfoOK
Bool_t WrkInfoOK() const
Definition: TProofPerfAnalysis.h:89
TProofPerfAnalysis::GetEvtRateAvg
Double_t GetEvtRateAvg() const
Definition: TProofPerfAnalysis.h:106
TSortedList.h
TProofPerfAnalysis::fMBRateRun
TH1F * fMBRateRun
Definition: TProofPerfAnalysis.h:59
TProofPerfAnalysis::fEvtRateMax
Double_t fEvtRateMax
Definition: TProofPerfAnalysis.h:53
TProofPerfAnalysis::LoadTree
void LoadTree(TDirectory *dir)
Load tree fTreeName from directory 'dir'.
Definition: TProofPerfAnalysis.cxx:364
TProofPerfAnalysis::fMBRate
TH1F * fMBRate
Definition: TProofPerfAnalysis.h:58
TProofPerfAnalysis::GetMBRateAvgMax
Double_t GetMBRateAvgMax() const
Definition: TProofPerfAnalysis.h:105
TProofPerfAnalysis::fMBRateAvgMax
Double_t fMBRateAvgMax
Definition: TProofPerfAnalysis.h:61
TProofPerfAnalysis::SetDebug
void SetDebug(Int_t d=0)
Static setter for the verbosity level.
Definition: TProofPerfAnalysis.cxx:1394
TProofPerfAnalysis::fTreeName
TString fTreeName
Definition: TProofPerfAnalysis.h:44
TProofPerfAnalysis::GetWrkFileList
void GetWrkFileList(TList *wl, TList *sl)
Fill file info.
Definition: TProofPerfAnalysis.cxx:586
TProofPerfAnalysis
Set of tools to analyse the performance tree.
Definition: TProofPerfAnalysis.h:32
TProofPerfAnalysis::fFile
TFile * fFile
Definition: TProofPerfAnalysis.h:39
TSortedList
A sorted doubly linked list.
Definition: TSortedList.h:28
TNamed
The TNamed class is the base class for all named ROOT classes.
Definition: TNamed.h:29
kFALSE
const Bool_t kFALSE
Definition: RtypesCore.h:101
TProofPerfAnalysis::LatencyPlot
void LatencyPlot(const char *wrks=0)
Show event processing or MB processing rate plot vs time Create the histograms.
Definition: TProofPerfAnalysis.cxx:1606
TProofPerfAnalysis::TWrkInfo
Definition: TProofPerfAnalysis.cxx:44
TProofPerfAnalysis::fWrksInfo
TSortedList fWrksInfo
Definition: TProofPerfAnalysis.h:46
TProofPerfAnalysis::fMBRateMax
Double_t fMBRateMax
Definition: TProofPerfAnalysis.h:54
TProofPerfAnalysis::fFileResult
TString fFileResult
Definition: TProofPerfAnalysis.h:64
TProofPerfAnalysis::FillFileDistOneSrv
void FillFileDistOneSrv(TH1F *hx, Bool_t wdet=kFALSE)
Fill file info when there is only one file server.
Definition: TProofPerfAnalysis.cxx:714
TProofPerfAnalysis::RatePlot
void RatePlot(const char *wrks=0)
Show event processing or MB processing rate plot vs time.
Definition: TProofPerfAnalysis.cxx:1504
TProofPerfAnalysis::TPackInfo
Definition: TProofPerfAnalysis.cxx:100
TProofPerfAnalysis::SetSaveResult
Int_t SetSaveResult(const char *file="results.root", Option_t *mode="RECREATE")
Set save result mode and validate 'file' according to 'mode'.
Definition: TProofPerfAnalysis.cxx:1429
TFile
A ROOT file is a suite of consecutive data records (TKey instances) with a well defined format.
Definition: TFile.h:54
TProofPerfAnalysis::PrintWrkInfo
void PrintWrkInfo(Int_t showlast=10)
Print information for all or the slowest showlast workers.
Definition: TProofPerfAnalysis.cxx:838
TProofPerfAnalysis::FillFileInfo
void FillFileInfo(Bool_t force=kFALSE)
Fill basic worker info; if 'force' rescan the TTree even already done.
Definition: TProofPerfAnalysis.cxx:1271
TProofPerfAnalysis::TFileInfo
Definition: TProofPerfAnalysis.cxx:147
TProofPerfAnalysis::SetgDebug
static void SetgDebug(Bool_t on=kTRUE)
Static setter for the verbosity level.
Definition: TProofPerfAnalysis.cxx:1472
Double_t
double Double_t
Definition: RtypesCore.h:59
TProofPerfAnalysis::FileProcPlot
void FileProcPlot(const char *fn, const char *out=0)
Show event processing or MB processing rate plot vs time.
Definition: TProofPerfAnalysis.cxx:1662
TCollection::GetSize
virtual Int_t GetSize() const
Return the capacity of the collection, i.e.
Definition: TCollection.h:182
file
Definition: file.py:1
TProofPerfAnalysis::GetMBRateAvg
Double_t GetMBRateAvg() const
Definition: TProofPerfAnalysis.h:107
TH1F
1-D histogram with a float per channel (see TH1 documentation)}
Definition: TH1.h:575
TObject
Mother of all ROOT objects.
Definition: TObject.h:37
ClassDef
#define ClassDef(name, id)
Definition: Rtypes.h:325
TProofPerfAnalysis::fMergeTime
Float_t fMergeTime
Definition: TProofPerfAnalysis.h:49
TProofPerfAnalysis::fEvtRateRun
TH1F * fEvtRateRun
Definition: TProofPerfAnalysis.h:57
name
char name[80]
Definition: TGX11.cxx:110
d
#define d(i)
Definition: RSha256.hxx:102
TDirectory
Describe directory structure in memory.
Definition: TDirectory.h:45
TProofPerfAnalysis::fInitTime
Float_t fInitTime
Definition: TProofPerfAnalysis.h:48
TProofPerfAnalysis::WorkerActivity
void WorkerActivity()
Measure the worker activity.
Definition: TProofPerfAnalysis.cxx:761
TProofPerfAnalysis::PrintFileInfo
void PrintFileInfo(Int_t showlast=10, const char *opt="", const char *out=0)
Print information for all or the slowest showlast workers.
Definition: TProofPerfAnalysis.cxx:886
TProofPerfAnalysis::GetEvtRateAvgMax
Double_t GetEvtRateAvgMax() const
Definition: TProofPerfAnalysis.h:104
TProofPerfAnalysis::fLatencyMax
Double_t fLatencyMax
Definition: TProofPerfAnalysis.h:55
TProofPerfAnalysis::IsValid
Bool_t IsValid() const
Definition: TProofPerfAnalysis.h:88
TProofPerfAnalysis::fDebug
Int_t fDebug
Definition: TProofPerfAnalysis.h:67
TProofPerfAnalysis::FileDist
void FileDist(Bool_t writedet=kFALSE)
Analyse the file distribution.
Definition: TProofPerfAnalysis.cxx:401
TProofPerfAnalysis::GetAverages
void GetAverages(Double_t &evtmax, Double_t &mbmax, Double_t &evt, Double_t &mb) const
Definition: TProofPerfAnalysis.h:108
TProofPerfAnalysis::TWrkEntry
Definition: TProofPerfAnalysis.cxx:135
TProofPerfAnalysis::EventDist
void EventDist()
Display event and packet distribution.
Definition: TProofPerfAnalysis.cxx:1479
TList
A doubly linked list.
Definition: TList.h:44
int