Logo ROOT   6.12/07
Reference Guide
TTreePerfStats.h
Go to the documentation of this file.
1 // @(#)root/treeplayer:$Id$
2 // Author: Rene Brun 29/10/09
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2009, 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_TTreePerfStats
13 #define ROOT_TTreePerfStats
14 
15 //////////////////////////////////////////////////////////////////////////
16 // //
17 // TTreePerfStats //
18 // //
19 // TTree I/O performance measurement //
20 // //
21 //////////////////////////////////////////////////////////////////////////
22 
23 
24 #include "TVirtualPerfStats.h"
25 #include "TString.h"
26 
27 
28 class TBrowser;
29 class TFile;
30 class TTree;
31 class TStopwatch;
32 class TPaveText;
33 class TGraphErrors;
34 class TGaxis;
35 class TText;
37 
38 protected:
39  Int_t fTreeCacheSize; //TTreeCache buffer size
40  Int_t fNleaves; //Number of leaves in the tree
41  Int_t fReadCalls; //Number of read calls
42  Int_t fReadaheadSize; //Readahead cache size
43  Long64_t fBytesRead; //Number of bytes read
44  Long64_t fBytesReadExtra;//Number of bytes (overhead) of the readahead cache
45  Double_t fRealNorm; //Real time scale factor for fGraphTime
46  Double_t fRealTime; //Real time
47  Double_t fCpuTime; //Cpu time
48  Double_t fDiskTime; //Time spent in pure raw disk IO
49  Double_t fUnzipTime; //Time spent uncompressing the data.
50  Double_t fCompress; //Tree compression factor
51  TString fName; //name of this TTreePerfStats
52  TString fHostInfo; //name of the host system, ROOT version and date
53  TFile *fFile; //!pointer to the file containing the Tree
54  TTree *fTree; //!pointer to the Tree being monitored
55  TGraphErrors *fGraphIO ; //pointer to the graph with IO data
56  TGraphErrors *fGraphTime ; //pointer to the graph with timestamp info
57  TPaveText *fPave; //pointer to annotation pavetext
58  TStopwatch *fWatch; //TStopwatch pointer
59  TGaxis *fRealTimeAxis; //pointer to TGaxis object showing real-time
60  TText *fHostInfoText; //Graphics Text object with the fHostInfo data
61 
62 public:
64  TTreePerfStats(const char *name, TTree *T);
65  virtual ~TTreePerfStats();
66  virtual void Browse(TBrowser *b);
67  virtual Int_t DistancetoPrimitive(Int_t px, Int_t py);
68  virtual void Draw(Option_t *option="");
69  virtual void ExecuteEvent(Int_t event, Int_t px, Int_t py);
70  virtual void Finish();
71  virtual Long64_t GetBytesRead() const {return fBytesRead;}
72  virtual Long64_t GetBytesReadExtra() const {return fBytesReadExtra;}
73  virtual Double_t GetCpuTime() const {return fCpuTime;}
74  virtual Double_t GetDiskTime() const {return fDiskTime;}
77  const char *GetHostInfo() const{return fHostInfo.Data();}
78  const char *GetName() const{return fName.Data();}
79  virtual Int_t GetNleaves() const {return fNleaves;}
80  virtual Long64_t GetNumEvents() const {return 0;}
81  TPaveText *GetPave() {return fPave;}
82  virtual Int_t GetReadaheadSize() const {return fReadaheadSize;}
83  virtual Int_t GetReadCalls() const {return fReadCalls;}
84  virtual Double_t GetRealTime() const {return fRealTime;}
85  TStopwatch *GetStopwatch() const {return fWatch;}
86  virtual Int_t GetTreeCacheSize() const {return fTreeCacheSize;}
87  virtual Double_t GetUnzipTime() const {return fUnzipTime; }
88  virtual void Paint(Option_t *chopt="");
89  virtual void Print(Option_t *option="") const;
90 
91  virtual void SimpleEvent(EEventType) {}
92  virtual void PacketEvent(const char *, const char *, const char *,
94  virtual void FileEvent(const char *, const char *, const char *, const char *, Bool_t) {}
95  virtual void FileOpenEvent(TFile *, const char *, Double_t) {}
96  virtual void FileReadEvent(TFile *file, Int_t len, Double_t start);
97  virtual void UnzipEvent(TObject *tree, Long64_t pos, Double_t start, Int_t complen, Int_t objlen);
98  virtual void RateEvent(Double_t , Double_t , Long64_t , Long64_t) {}
99 
100  virtual void SaveAs(const char *filename="",Option_t *option="") const;
101  virtual void SavePrimitive(std::ostream &out, Option_t *option = "");
102  virtual void SetBytesRead(Long64_t nbytes) {fBytesRead = nbytes;}
103  virtual void SetBytesReadExtra(Long64_t nbytes) {fBytesReadExtra = nbytes;}
104  virtual void SetCompress(Double_t cx) {fCompress = cx;}
105  virtual void SetDiskTime(Double_t t) {fDiskTime = t;}
106  virtual void SetNumEvents(Long64_t) {}
107  virtual void SetCpuTime(Double_t cptime) {fCpuTime = cptime;}
108  virtual void SetGraphIO(TGraphErrors *gr) {fGraphIO = gr;}
109  virtual void SetGraphTime(TGraphErrors *gr) {fGraphTime = gr;}
110  virtual void SetHostInfo(const char *info) {fHostInfo = info;}
111  virtual void SetName(const char *name) {fName = name;}
112  virtual void SetNleaves(Int_t nleaves) {fNleaves = nleaves;}
113  virtual void SetReadaheadSize(Int_t nbytes) {fReadaheadSize = nbytes;}
114  virtual void SetReadCalls(Int_t ncalls) {fReadCalls = ncalls;}
115  virtual void SetRealNorm(Double_t rnorm) {fRealNorm = rnorm;}
116  virtual void SetRealTime(Double_t rtime) {fRealTime = rtime;}
117  virtual void SetTreeCacheSize(Int_t nbytes) {fTreeCacheSize = nbytes;}
118  virtual void SetUnzipTime(Double_t uztime) {fUnzipTime = uztime;}
119 
120  ClassDef(TTreePerfStats,6) // TTree I/O performance measurement
121 };
122 
123 #endif
virtual void ExecuteEvent(Int_t event, Int_t px, Int_t py)
Return distance to one of the objects in the TTreePerfStats.
virtual void Browse(TBrowser *b)
Browse.
virtual void SetBytesReadExtra(Long64_t nbytes)
virtual void SetDiskTime(Double_t t)
Long64_t fBytesRead
virtual Int_t DistancetoPrimitive(Int_t px, Int_t py)
Return distance to one of the objects in the TTreePerfStats.
virtual void FileReadEvent(TFile *file, Int_t len, Double_t start)
Record TTree file read event.
virtual Int_t GetReadCalls() const
long long Long64_t
Definition: RtypesCore.h:69
TPaveText * GetPave()
TGraphErrors * fGraphIO
pointer to the Tree being monitored
TGraphErrors * GetGraphTime()
virtual void SetNumEvents(Long64_t)
Provides the interface for the PROOF internal performance measurement and event tracing.
virtual void FileOpenEvent(TFile *, const char *, Double_t)
const char Option_t
Definition: RtypesCore.h:62
virtual void Finish()
When the run is finished this function must be called to save the current parameters in the file and ...
virtual void SetReadaheadSize(Int_t nbytes)
double T(double x)
Definition: ChebyshevPol.h:34
virtual void Print(Option_t *option="") const
Print the TTree I/O perf stats.
A ROOT file is a suite of consecutive data records (TKey instances) with a well defined format...
Definition: TFile.h:46
Long64_t fBytesReadExtra
const char * GetHostInfo() const
Double_t fRealTime
virtual Double_t GetUnzipTime() const
Basic string class.
Definition: TString.h:125
virtual void SaveAs(const char *filename="", Option_t *option="") const
Save this object to filename.
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
virtual void SimpleEvent(EEventType)
virtual void RateEvent(Double_t, Double_t, Long64_t, Long64_t)
virtual void SetCpuTime(Double_t cptime)
TGaxis * fRealTimeAxis
#define ClassDef(name, id)
Definition: Rtypes.h:320
virtual void SetTreeCacheSize(Int_t nbytes)
Double_t fUnzipTime
virtual void SetBytesRead(Long64_t nbytes)
Base class for several text objects.
Definition: TText.h:23
virtual void SetCompress(Double_t cx)
virtual void SetRealTime(Double_t rtime)
virtual void SetGraphTime(TGraphErrors *gr)
virtual void FileEvent(const char *, const char *, const char *, const char *, Bool_t)
TStopwatch * GetStopwatch() const
Double_t fDiskTime
virtual void SetGraphIO(TGraphErrors *gr)
const char * GetName() const
Returns name of object.
Using a TBrowser one can browse all ROOT objects.
Definition: TBrowser.h:37
virtual Int_t GetNleaves() const
virtual Double_t GetRealTime() const
Double_t fCompress
virtual void SetName(const char *name)
virtual void UnzipEvent(TObject *tree, Long64_t pos, Double_t start, Int_t complen, Int_t objlen)
Record TTree unzip event.
virtual ~TTreePerfStats()
Destructor.
virtual Double_t GetCpuTime() const
virtual void SetReadCalls(Int_t ncalls)
The axis painter class.
Definition: TGaxis.h:24
TTree I/O performance measurement.
TStopwatch * fWatch
TGraphErrors * gr
Definition: legend1.C:25
TGraphErrors * GetGraphIO()
Double_t fCpuTime
virtual void SetNleaves(Int_t nleaves)
A Pave (see TPave) with text, lines or/and boxes inside.
Definition: TPaveText.h:21
virtual void SetRealNorm(Double_t rnorm)
virtual Long64_t GetNumEvents() const
virtual void SetUnzipTime(Double_t uztime)
double Double_t
Definition: RtypesCore.h:55
virtual Int_t GetTreeCacheSize() const
virtual void PacketEvent(const char *, const char *, const char *, Long64_t, Double_t, Double_t, Double_t, Long64_t)
Mother of all ROOT objects.
Definition: TObject.h:37
TText * fHostInfoText
virtual void SetHostInfo(const char *info)
virtual void Paint(Option_t *chopt="")
Draw the TTree I/O perf graph.
virtual Long64_t GetBytesRead() const
Definition: file.py:1
TTree * fTree
pointer to the file containing the Tree
Double_t fRealNorm
you should not use this method at all Int_t Int_t Double_t Double_t Double_t Int_t Double_t Double_t Double_t Double_t b
Definition: TRolke.cxx:630
A TGraphErrors is a TGraph with error bars.
Definition: TGraphErrors.h:26
Definition: tree.py:1
TTreePerfStats()
default constructor (used when reading an object only)
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save primitive as a C++ statement(s) on output stream out.
A TTree object has a header with a name and a title.
Definition: TTree.h:70
virtual Long64_t GetBytesReadExtra() const
virtual Int_t GetReadaheadSize() const
TGraphErrors * fGraphTime
virtual Double_t GetDiskTime() const
char name[80]
Definition: TGX11.cxx:109
virtual void Draw(Option_t *option="")
Draw the TTree I/O perf graph.
TPaveText * fPave
const char * Data() const
Definition: TString.h:345
Stopwatch class.
Definition: TStopwatch.h:28