Logo ROOT  
Reference Guide
TPerfStats.h
Go to the documentation of this file.
1 // @(#)root/proofplayer:$Id$
2 // Author: Kristjan Gulbrandsen 11/05/04
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2004, 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_TPerfStats
13 #define ROOT_TPerfStats
14 
15 //////////////////////////////////////////////////////////////////////////
16 // //
17 // TPerfStats //
18 // //
19 // Provides the interface for the PROOF internal performance measurment //
20 // and event tracing. //
21 // //
22 //////////////////////////////////////////////////////////////////////////
23 
24 
25 #include "TObject.h"
26 #include "TObjArray.h"
27 #include "TTimeStamp.h"
28 #include "TString.h"
29 #include "TVirtualPerfStats.h"
30 
31 
32 class TDSet;
33 class TH1D;
34 class TH1I;
35 class TH2D;
36 class TList;
37 class TTree;
38 
39 class TPerfEvent : public TObject {
40 
41 public:
42  TString fEvtNode; // node on which the event was generated
43  TTimeStamp fTimeStamp; // time offset from start of run
58 
59  TPerfEvent(TTimeStamp *offset = 0);
60  virtual ~TPerfEvent() {}
61 
62  Bool_t IsSortable() const { return kTRUE; }
63  Int_t Compare(const TObject *obj) const;
64  void Print(Option_t *option="") const;
65 
66  ClassDef(TPerfEvent,3) // Class holding TProof Event Info
67 };
68 
69 
70 class TPerfStats : public TVirtualPerfStats {
71 
72 friend class TProofMonSender;
73 
74 private:
75  TTree *fTrace; //!TTree with trace events
76  TTimeStamp fTzero; //!start time of this run
77  TPerfEvent *fPerfEvent; //!TPerfEvent used to fill tree
78  TH1D *fPacketsHist; //!histogram of packets processed per slave
79  TH1I *fProcPcktHist; //!histogram of packets being processed per slave
80  TH1D *fEventsHist; //!histogram of events processed per slave
81  TH1D *fNodeHist; //!histogram of slaves per file serving node
82  TH2D *fLatencyHist; //!histogram of latency due to packet requests
83  TH2D *fProcTimeHist; //!histogram of real time spent processing packets
84  TH2D *fCpuTimeHist; //!histogram of cpu time spent processing packets
85  Long64_t fBytesRead; //!track bytes read of main file
86  Double_t fTotCpuTime; //!total cpu time of all slaves
87  Long64_t fTotBytesRead; //!total bytes read on all slaves
88  Long64_t fTotEvents; //!total number of events processed
89  Long64_t fNumEvents; //!total number of events to be processed
90  Int_t fSlaves; //!number of active slaves
91 
92  Bool_t fDoHist; //!Fill histos
93  Bool_t fDoTrace; //!Trace details in master
94  Bool_t fDoTraceRate; //!Trace processing rate in master
95  Bool_t fDoSlaveTrace; //!Full tracing in workers
96  Bool_t fDoQuota; //!Save stats on SQL server for quota management
97 
98  Bool_t fMonitorPerPacket; //!Whether to send the full entry per each packet
99 
100  TObjArray fMonSenders; //!Monitoring engines
101 
102  TString fDataSet; //!Dataset string
103  Int_t fDataSetLen; //!Maximum size of the dataset string fDataSet
104  Int_t fDataSetSize; //!# of files in the dataset
105  TDSet *fDSet; //!Saved pointer to the TDSet object
106  TList *fOutput; //!Saved pointer to the output list
107 
108  static Long_t fgVirtMemMax; //! Max virtual memory used by this process
109  static Long_t fgResMemMax; //! Max resident memory used by this process
110 
111  TPerfStats(TList *input, TList *output);
112  void WriteQueryLog();
113 
114 public:
115  virtual ~TPerfStats();
116 
118  void PacketEvent(const char *slave, const char *slavename, const char *filename,
119  Long64_t eventsprocessed, Double_t latency,
120  Double_t proctime, Double_t cputime, Long64_t bytesRead);
121  void FileEvent(const char *slave, const char *slavename, const char *nodename, const char *filename,
122  Bool_t isStart);
123 
124  void FileOpenEvent(TFile *file, const char *filename, Double_t start);
125  void FileReadEvent(TFile *file, Int_t len, Double_t start);
126  void UnzipEvent(TObject *tree, Long64_t pos, Double_t start, Int_t complen, Int_t objlen);
127  void RateEvent(Double_t proctime, Double_t deltatime,
128  Long64_t eventsprocessed, Long64_t bytesRead);
129  void SetBytesRead(Long64_t num);
130  Long64_t GetBytesRead() const;
131  void SetNumEvents(Long64_t num) { fNumEvents = num; }
132  Long64_t GetNumEvents() const { return fNumEvents; }
133 
134  void PrintBasketInfo(Option_t * = "") const {}
135  void SetLoaded(TBranch *, size_t) {}
136  void SetLoaded(size_t, size_t) {}
137  void SetLoadedMiss(TBranch *, size_t) {}
138  void SetLoadedMiss(size_t, size_t) {}
139  void SetMissed(TBranch *, size_t) {}
140  void SetMissed(size_t, size_t) {}
141  void SetUsed(TBranch *, size_t) {}
142  void SetUsed(size_t, size_t) {}
144 
145  static void Start(TList *input, TList *output);
146  static void Stop();
147  static void Setup(TList *input);
148  static void SetMemValues();
149  static void GetMemValues(Long_t &vmax, Long_t &rmax);
150 
151  ClassDef(TPerfStats,0) // Class for collecting PROOF statistics
152 };
153 
154 
155 #endif
TPerfStats::fSlaves
Int_t fSlaves
total number of events to be processed
Definition: TPerfStats.h:90
TVirtualPerfStats.h
TPerfStats::fDoQuota
Bool_t fDoQuota
Full tracing in workers.
Definition: TPerfStats.h:96
TPerfEvent::fFileName
TString fFileName
Definition: TPerfStats.h:47
TPerfStats::SetLoadedMiss
void SetLoadedMiss(TBranch *, size_t)
Definition: TPerfStats.h:137
kTRUE
const Bool_t kTRUE
Definition: RtypesCore.h:91
TPerfEvent::fSlave
TString fSlave
Definition: TPerfStats.h:49
TPerfStats::fDoTraceRate
Bool_t fDoTraceRate
Trace details in master.
Definition: TPerfStats.h:94
TObjArray
Definition: TObjArray.h:37
TPerfStats::SetLoaded
void SetLoaded(TBranch *, size_t)
Definition: TPerfStats.h:135
TPerfStats::fDoSlaveTrace
Bool_t fDoSlaveTrace
Trace processing rate in master.
Definition: TPerfStats.h:95
TPerfEvent::fProcTime
Double_t fProcTime
Definition: TPerfStats.h:54
TPerfEvent::fEventsProcessed
Long64_t fEventsProcessed
Definition: TPerfStats.h:50
TPerfStats::TPerfStats
TPerfStats(TList *input, TList *output)
Max resident memory used by this process.
Definition: TPerfStats.cxx:118
TH1I
1-D histogram with an int per channel (see TH1 documentation)}
Definition: TH1.h:531
TTimeStamp.h
TPerfStats::Setup
static void Setup(TList *input)
Setup the PROOF input list with requested statistics and tracing options.
Definition: TPerfStats.cxx:727
TPerfStats::PrintBasketInfo
void PrintBasketInfo(Option_t *="") const
Definition: TPerfStats.h:134
tree
Definition: tree.py:1
TPerfStats::fDataSetSize
Int_t fDataSetSize
Maximum size of the dataset string fDataSet.
Definition: TPerfStats.h:104
Long64_t
long long Long64_t
Definition: RtypesCore.h:73
TPerfEvent
Definition: TPerfStats.h:39
TPerfStats::fProcTimeHist
TH2D * fProcTimeHist
histogram of latency due to packet requests
Definition: TPerfStats.h:83
TPerfStats::fDSet
TDSet * fDSet
Definition: TPerfStats.h:105
TPerfEvent::fFileClass
TString fFileClass
Definition: TPerfStats.h:48
output
static void output(int code)
Definition: gifencode.c:226
TPerfStats::PacketEvent
void PacketEvent(const char *slave, const char *slavename, const char *filename, Long64_t eventsprocessed, Double_t latency, Double_t proctime, Double_t cputime, Long64_t bytesRead)
Packet event.
Definition: TPerfStats.cxx:413
TPerfStats::SetBytesRead
void SetBytesRead(Long64_t num)
Set number of bytes read.
Definition: TPerfStats.cxx:629
TTree
Definition: TTree.h:79
TH1D
1-D histogram with a double per channel (see TH1 documentation)}
Definition: TH1.h:615
TPerfStats::SetUsed
void SetUsed(size_t, size_t)
Definition: TPerfStats.h:142
TPerfStats::fgVirtMemMax
static Long_t fgVirtMemMax
Saved pointer to the output list.
Definition: TPerfStats.h:108
Int_t
int Int_t
Definition: RtypesCore.h:45
TVirtualPerfStats
Definition: TVirtualPerfStats.h:31
TPerfStats::fProcPcktHist
TH1I * fProcPcktHist
histogram of packets processed per slave
Definition: TPerfStats.h:79
TPerfStats::fTzero
TTimeStamp fTzero
TTree with trace events.
Definition: TPerfStats.h:76
TPerfEvent::Compare
Int_t Compare(const TObject *obj) const
Compare method.
Definition: TPerfStats.cxx:77
TPerfEvent::TPerfEvent
TPerfEvent(TTimeStamp *offset=0)
Constructor.
Definition: TPerfStats.cxx:53
TPerfStats::SetUsed
void SetUsed(TBranch *, size_t)
Definition: TPerfStats.h:141
TPerfStats::SetMemValues
static void SetMemValues()
Record memory usage.
Definition: TPerfStats.cxx:778
TVirtualPerfStats::EEventType
EEventType
Definition: TVirtualPerfStats.h:36
TPerfEvent::fLen
Long64_t fLen
Definition: TPerfStats.h:52
TPerfStats::fTotCpuTime
Double_t fTotCpuTime
track bytes read of main file
Definition: TPerfStats.h:86
TString
Definition: TString.h:136
TPerfEvent::Print
void Print(Option_t *option="") const
Dump content of this instance.
Definition: TPerfStats.cxx:98
TPerfEvent::fTimeStamp
TTimeStamp fTimeStamp
Definition: TPerfStats.h:43
TPerfStats::SetMissed
void SetMissed(TBranch *, size_t)
Definition: TPerfStats.h:139
TPerfStats::fMonitorPerPacket
Bool_t fMonitorPerPacket
Save stats on SQL server for quota management.
Definition: TPerfStats.h:98
TString.h
TPerfStats::fTrace
TTree * fTrace
Definition: TPerfStats.h:75
TPerfStats::fEventsHist
TH1D * fEventsHist
histogram of packets being processed per slave
Definition: TPerfStats.h:80
bool
TPerfEvent::fType
TVirtualPerfStats::EEventType fType
Definition: TPerfStats.h:44
TBranch
Definition: TBranch.h:89
TPerfEvent::fLatency
Double_t fLatency
Definition: TPerfStats.h:53
TPerfStats::fPacketsHist
TH1D * fPacketsHist
TPerfEvent used to fill tree.
Definition: TPerfStats.h:78
TPerfStats::Start
static void Start(TList *input, TList *output)
Initialize PROOF statistics run.
Definition: TPerfStats.cxx:744
TPerfEvent::fBytesRead
Long64_t fBytesRead
Definition: TPerfStats.h:51
Option_t
const typedef char Option_t
Definition: RtypesCore.h:66
TPerfStats::GetNumEvents
Long64_t GetNumEvents() const
Definition: TPerfStats.h:132
TPerfStats::GetMemValues
static void GetMemValues(Long_t &vmax, Long_t &rmax)
Get memory usage.
Definition: TPerfStats.cxx:790
TPerfStats::UnzipEvent
void UnzipEvent(TObject *tree, Long64_t pos, Double_t start, Int_t complen, Int_t objlen)
Record TTree file unzip event.
Definition: TPerfStats.cxx:597
TPerfStats::SetMissed
void SetMissed(size_t, size_t)
Definition: TPerfStats.h:140
TPerfEvent::fSlaveName
TString fSlaveName
Definition: TPerfStats.h:45
Long_t
long Long_t
Definition: RtypesCore.h:54
TH2D
2-D histogram with a double per channel (see TH1 documentation)}
Definition: TH2.h:292
TPerfEvent::IsSortable
Bool_t IsSortable() const
Definition: TPerfStats.h:62
TPerfStats::fPerfEvent
TPerfEvent * fPerfEvent
start time of this run
Definition: TPerfStats.h:77
TPerfEvent::fCpuTime
Double_t fCpuTime
Definition: TPerfStats.h:55
TPerfStats::SimpleEvent
void SimpleEvent(EEventType type)
Simple event.
Definition: TPerfStats.cxx:387
TPerfStats::UpdateBranchIndices
void UpdateBranchIndices(TObjArray *)
Definition: TPerfStats.h:143
TDSet
Definition: TDSet.h:153
TPerfEvent::fIsOk
Bool_t fIsOk
Definition: TPerfStats.h:57
TFile
Definition: TFile.h:54
TPerfStats::fBytesRead
Long64_t fBytesRead
histogram of cpu time spent processing packets
Definition: TPerfStats.h:85
TPerfStats::fTotEvents
Long64_t fTotEvents
total bytes read on all slaves
Definition: TPerfStats.h:88
TPerfStats::SetLoaded
void SetLoaded(size_t, size_t)
Definition: TPerfStats.h:136
TPerfEvent::fNodeName
TString fNodeName
Definition: TPerfStats.h:46
TPerfStats::fNodeHist
TH1D * fNodeHist
histogram of events processed per slave
Definition: TPerfStats.h:81
TPerfStats::Stop
static void Stop()
Terminate the PROOF statistics run.
Definition: TPerfStats.cxx:764
TPerfStats::SetLoadedMiss
void SetLoadedMiss(size_t, size_t)
Definition: TPerfStats.h:138
Double_t
double Double_t
Definition: RtypesCore.h:59
TPerfEvent::fIsStart
Bool_t fIsStart
Definition: TPerfStats.h:56
TPerfStats::fOutput
TList * fOutput
Saved pointer to the TDSet object.
Definition: TPerfStats.h:106
TObject.h
TObjArray.h
TPerfStats::GetBytesRead
Long64_t GetBytesRead() const
Get number of bytes read.
Definition: TPerfStats.cxx:637
TPerfEvent::fEvtNode
TString fEvtNode
Definition: TPerfStats.h:42
TPerfStats::FileOpenEvent
void FileOpenEvent(TFile *file, const char *filename, Double_t start)
Open file event.
Definition: TPerfStats.cxx:551
TPerfStats::fMonSenders
TObjArray fMonSenders
Whether to send the full entry per each packet.
Definition: TPerfStats.h:100
TPerfEvent::~TPerfEvent
virtual ~TPerfEvent()
Definition: TPerfStats.h:60
TPerfStats::FileEvent
void FileEvent(const char *slave, const char *slavename, const char *nodename, const char *filename, Bool_t isStart)
File event.
Definition: TPerfStats.cxx:524
TPerfStats::~TPerfStats
virtual ~TPerfStats()
Destructor.
Definition: TPerfStats.cxx:377
file
Definition: file.py:1
TPerfStats::FileReadEvent
void FileReadEvent(TFile *file, Int_t len, Double_t start)
Read file event.
Definition: TPerfStats.cxx:572
TPerfStats::RateEvent
void RateEvent(Double_t proctime, Double_t deltatime, Long64_t eventsprocessed, Long64_t bytesRead)
Rate event.
Definition: TPerfStats.cxx:607
TObject
Definition: TObject.h:37
ClassDef
#define ClassDef(name, id)
Definition: Rtypes.h:325
TProofMonSender
Definition: TProofMonSender.h:30
TPerfStats::fLatencyHist
TH2D * fLatencyHist
histogram of slaves per file serving node
Definition: TPerfStats.h:82
TPerfStats::fDataSetLen
Int_t fDataSetLen
Dataset string.
Definition: TPerfStats.h:103
TPerfStats::fDoHist
Bool_t fDoHist
number of active slaves
Definition: TPerfStats.h:92
TPerfStats::fCpuTimeHist
TH2D * fCpuTimeHist
histogram of real time spent processing packets
Definition: TPerfStats.h:84
TPerfStats::fTotBytesRead
Long64_t fTotBytesRead
total cpu time of all slaves
Definition: TPerfStats.h:87
TPerfStats::fNumEvents
Long64_t fNumEvents
total number of events processed
Definition: TPerfStats.h:89
type
int type
Definition: TGX11.cxx:121
TPerfStats
Definition: TPerfStats.h:70
TTimeStamp
Definition: TTimeStamp.h:71
TPerfStats::fDoTrace
Bool_t fDoTrace
Fill histos.
Definition: TPerfStats.h:93
TPerfStats::fDataSet
TString fDataSet
Monitoring engines.
Definition: TPerfStats.h:102
TPerfStats::WriteQueryLog
void WriteQueryLog()
Send to the connected monitoring servers information related to this query.
Definition: TPerfStats.cxx:648
TPerfStats::SetNumEvents
void SetNumEvents(Long64_t num)
Definition: TPerfStats.h:131
TList
Definition: TList.h:44
TPerfStats::fgResMemMax
static Long_t fgResMemMax
Max virtual memory used by this process.
Definition: TPerfStats.h:109
int