ROOT  6.07/01
Reference Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 #ifndef ROOT_TNamed
24 #include "TNamed.h"
25 #endif
26 #ifndef ROOT_TSortedList
27 #include "TSortedList.h"
28 #endif
29 #ifndef ROOT_TString
30 #include "TString.h"
31 #endif
32 
33 class TFile;
34 class TH1F;
35 class TH2F;
36 class TList;
37 class TTree;
38 class TProofPerfAnalysis : public TNamed {
39 
40 public: // public because of Sun CC bug
41  class TFileInfo;
42  class TPackInfo;
43  class TWrkEntry;
44  class TWrkInfo;
45  class TWrkInfoFile;
46 
47 private:
48  TFile *fFile; // The open performance file
49  TString fDirName; // The name of the subdir with the perfomance tree
50  TString fTreeName; // The name of the performance tree
51  TTree *fTree; // The performance tree
52  TSortedList fWrksInfo; // Sorted list of workers info
53  TSortedList fFilesInfo; // Sorted list of files info
54  Float_t fInitTime; // End of initialization time for this query
55  Float_t fMergeTime; // Begin of merging time for this query
56  Float_t fMaxTime; // Max time for this query (slowest worker)
57  TH1F *fEvents; // Event distribution per worker
58  TH1F *fPackets; // Packet distribution per worker
59  Double_t fEvtRateMax; // Max event processing rate per packet
60  Double_t fMBRateMax; // Max MB processing rate per packet
61  Double_t fLatencyMax; // Max retrieval latency per packet
62  TH1F *fEvtRate; // Event processing rate vs query time
63  TH1F *fEvtRateRun; // Event processing rate running avg vs query time
64  TH1F *fMBRate; // Byte processing rate vs query time
65  TH1F *fMBRateRun; // Byte processing rate running avg vs query time
66  Double_t fEvtRateAvgMax; // Max running event processing rate
67  Double_t fMBRateAvgMax; // Max running MB processing rate
68  Double_t fEvtRateAvg; // Average event processing rate
69  Double_t fMBRateAvg; // Average MB processing rate
70  TString fFileResult; // File where to save basics of a run when requested
71  Bool_t fSaveResult; // Whether to save the results of a run
72 
73  Int_t fDebug; // Local verbosity level
74 
75  static Bool_t fgDebug; // Global verbosity on/off
76 
77  Int_t CompareOrd(const char *ord1, const char *ord2);
78  void FillFileDist(TH1F *hf, TH1F *hb, TH2F *hx, Bool_t wdet = kFALSE);
79  void FillFileDistOneSrv(TH1F *hx, Bool_t wdet = kFALSE);
80  void FillWrkInfo(Bool_t force = kFALSE);
81  void FillFileInfo(Bool_t force = kFALSE);
82  TString GetCanvasTitle(const char *t);
83  void GetWrkFileList(TList *wl, TList *sl);
84  void LoadTree(TDirectory *dir);
85  void DoDraw(TObject *o, Option_t *opt = "", const char *name = 0);
86 
87 public:
88 
89  TProofPerfAnalysis(const char *perffile, const char *title = "",
90  const char *treename = "PROOF_PerfStats");
91  TProofPerfAnalysis(TTree *tree, const char *title = "");
92  virtual ~TProofPerfAnalysis();
93 
94  Bool_t IsValid() const { return (fFile && fTree) ? kTRUE : kFALSE; }
95  Bool_t WrkInfoOK() const { return (fWrksInfo.GetSize() > 0) ? kTRUE : kFALSE; }
96 
97  void EventDist(); // Analyse event and packet distribution
98  void FileDist(Bool_t writedet = kFALSE); // Analyse the file distribution
99  void LatencyPlot(const char *wrks = 0); // Packet latency distribution vs time
100  void RatePlot(const char *wrks = 0); // Rate distribution vs time
101  void WorkerActivity(); // Analyse the worker activity
102  void PrintWrkInfo(Int_t showlast = 10); // Print workers info
103  void PrintWrkInfo(const char *wrk); // Print worker info by name
104 
105  void PrintFileInfo(Int_t showlast = 10, const char *opt = "", const char *out = 0); // Print file info
106  void PrintFileInfo(const char *fn, const char *opt = "P", const char *out = 0); // Print file info by name
107  void FileProcPlot(const char *fn, const char *out = 0); // Plot info about file processing
108  void FileRatePlot(const char *fns = 0); // Plot info about file processing rates
109 
110  Double_t GetEvtRateAvgMax() const { return fEvtRateAvgMax; } // Max running event processing rate
111  Double_t GetMBRateAvgMax() const { return fMBRateAvgMax; } // Max running MB processing rate
112  Double_t GetEvtRateAvg() const { return fEvtRateAvg; } // Average event processing rate
113  Double_t GetMBRateAvg() const { return fMBRateAvg; } // Average MB processing rate
114  void GetAverages(Double_t &evtmax, Double_t &mbmax, Double_t &evt, Double_t &mb) const
115  { evtmax = fEvtRateAvgMax; mbmax = fMBRateAvgMax; evt = fEvtRateAvg; mb = fMBRateAvg; return; }
116 
117  void Summary(Option_t *opt = "", const char *out = "");
118 
119  Int_t SetSaveResult(const char *file = "results.root", Option_t *mode = "RECREATE");
120 
121  void SetDebug(Int_t d = 0); // Setter for the verbosity level
122  static void SetgDebug(Bool_t on = kTRUE); // Overall verbosity level
123 
124  ClassDef(TProofPerfAnalysis, 0) // Set of tools to analyse the performance tree
125 };
126 
127 #endif
void SetDebug(Int_t d=0)
Static setter for the verbosity level.
virtual ~TProofPerfAnalysis()
Destructor: detach the tree and close the file.
float Float_t
Definition: RtypesCore.h:53
TString GetCanvasTitle(const char *t)
If defined, add '- <this title>="">' to the canvas title 't'.
void PrintFileInfo(Int_t showlast=10, const char *opt="", const char *out=0)
Print information for all or the slowest showlast workers.
const char Option_t
Definition: RtypesCore.h:62
TFileInfo(const char *url=0, Long64_t size=-1, const char *uuid=0, const char *md5=0, TObject *meta=0)
Set of tools to analyse the performance tree.
A ROOT file is a suite of consecutive data records (TKey instances) with a well defined format...
Definition: TFile.h:45
Basic string class.
Definition: TString.h:137
1-D histogram with a float per channel (see TH1 documentation)}
Definition: TH1.h:570
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
Bool_t IsValid() const
const Bool_t kFALSE
Definition: Rtypes.h:92
void GetAverages(Double_t &evtmax, Double_t &mbmax, Double_t &evt, Double_t &mb) const
void LoadTree(TDirectory *dir)
Load tree fTreeName from directory 'dir'.
void FileDist(Bool_t writedet=kFALSE)
Analyse the file distribution.
void FileProcPlot(const char *fn, const char *out=0)
Show event processing or MB processing rate plot vs time.
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.
#define ClassDef(name, id)
Definition: Rtypes.h:254
The TNamed class is the base class for all named ROOT classes.
Definition: TNamed.h:33
int d
Definition: tornado.py:11
void EventDist()
Display event and packet distribution.
Bool_t WrkInfoOK() const
A sorted doubly linked list.
Definition: TSortedList.h:30
void FileRatePlot(const char *fns=0)
Show MB processing rate plot per file vs time.
void RatePlot(const char *wrks=0)
Show event processing or MB processing rate plot vs time.
Double_t GetEvtRateAvgMax() const
char * out
Definition: TBase64.cxx:29
TProofPerfAnalysis(const char *perffile, const char *title="", const char *treename="PROOF_PerfStats")
Constructor: open the file and attach to the tree.
A doubly linked list.
Definition: TList.h:47
TThread * t[5]
Definition: threadsh1.C:13
Int_t SetSaveResult(const char *file="results.root", Option_t *mode="RECREATE")
Set save result mode and validate 'file' according to 'mode'.
TPaveLabel title(3, 27.1, 15, 28.7,"ROOT Environment and Tools")
2-D histogram with a float per channel (see TH1 documentation)}
Definition: TH2.h:256
static void SetgDebug(Bool_t on=kTRUE)
Static setter for the verbosity level.
void WorkerActivity()
Measure the worker activity.
tuple tree
Definition: tree.py:24
virtual Int_t GetSize() const
Definition: TCollection.h:95
tuple file
Definition: fildir.py:20
void GetWrkFileList(TList *wl, TList *sl)
Fill file info.
double Double_t
Definition: RtypesCore.h:55
Describe directory structure in memory.
Definition: TDirectory.h:44
void dir(char *path=0)
Definition: rootalias.C:30
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 FillFileDistOneSrv(TH1F *hx, Bool_t wdet=kFALSE)
Fill file info when there is only one file server.
#define name(a, b)
Definition: linkTestLib0.cpp:5
Mother of all ROOT objects.
Definition: TObject.h:58
void FillFileDist(TH1F *hf, TH1F *hb, TH2F *hx, Bool_t wdet=kFALSE)
Fill file info.
Double_t GetEvtRateAvg() const
A TTree object has a header with a name and a title.
Definition: TTree.h:98
void LatencyPlot(const char *wrks=0)
Show event processing or MB processing rate plot vs time Create the histograms.
void FillFileInfo(Bool_t force=kFALSE)
Fill basic worker info; if 'force' rescan the TTree even already done.
const Bool_t kTRUE
Definition: Rtypes.h:91
void FillWrkInfo(Bool_t force=kFALSE)
Fill basic worker info; if 'force' rescan the TTree even already done.
Double_t GetMBRateAvgMax() const
void Summary(Option_t *opt="", const char *out="")
Print summary of query.
Double_t GetMBRateAvg() const
void PrintWrkInfo(Int_t showlast=10)
Print information for all or the slowest showlast workers.