ATLAS Offline Software
PerfStats.h
Go to the documentation of this file.
1 // Dear emacs, this is -*- c++ -*-
2 /*
3  Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
4 */
5 #ifndef XAODCORE_TOOLS_PERFSTATS_H
6 #define XAODCORE_TOOLS_PERFSTATS_H
7 
8 // ROOT include(s):
9 #include <TVirtualPerfStats.h>
10 
11 // Athena include(s).
13 
14 // System include(s).
15 #include <mutex>
16 
17 // Forward declaration(s):
18 class TTree;
19 
20 namespace xAOD {
21 
34  class PerfStats : public ::TVirtualPerfStats {
35 
36  public:
39 
41  static PerfStats& instance();
42 
44  void start( bool clear = true );
46  void stop();
47 
50 
52  virtual void SimpleEvent( EEventType type );
54  virtual void PacketEvent( const char *slave, const char *slavename,
55  const char *filename,
56  ::Long64_t eventsprocessed,
57  ::Double_t latency, ::Double_t proctime,
58  ::Double_t cputime, ::Long64_t bytesRead );
60  virtual void FileEvent( const char *slave, const char *slavename,
61  const char *nodename, const char *filename,
62  ::Bool_t isStart );
64  virtual void FileOpenEvent( ::TFile *file, const char *filename,
65  ::Double_t start );
67  virtual void FileReadEvent( ::TFile *file, ::Int_t len,
68  ::Double_t start );
70  virtual void UnzipEvent( ::TObject *tree, ::Long64_t pos,
71  ::Double_t start, ::Int_t complen,
72  ::Int_t objlen );
74  virtual void RateEvent( ::Double_t proctime, ::Double_t deltatime,
75  ::Long64_t eventsprocessed,
76  ::Long64_t bytesRead );
78  virtual void SetBytesRead( ::Long64_t num );
80  virtual ::Long64_t GetBytesRead() const;
82  virtual void SetNumEvents( ::Long64_t num );
84  virtual ::Long64_t GetNumEvents() const;
85 
87  virtual void PrintBasketInfo(Option_t *option = "") const;
88 
90  virtual void SetLoaded(TBranch *b, size_t basketNumber);
91  virtual void SetLoaded(size_t bi, size_t basketNumber);
92 
94  virtual void SetLoadedMiss(TBranch *b, size_t basketNumber);
95  virtual void SetLoadedMiss(size_t bi, size_t basketNumber);
96 
98  virtual void SetMissed(TBranch *b, size_t basketNumber);
99  virtual void SetMissed(size_t bi, size_t basketNumber);
100 
102  virtual void SetUsed(TBranch *b, size_t basketNumber);
103  virtual void SetUsed(size_t bi, size_t basketNumber);
104 
107  virtual void UpdateBranchIndices(TObjArray *branches);
108 
110 
111  protected:
114 
115  private:
116 #if ROOT_VERSION_CODE >= ROOT_VERSION( 6, 23, 2 )
117  virtual void SetFile( TFile* file );
119 #endif // ROOT version
120 
122  static PerfStats* s_instance ATLAS_THREAD_SAFE;
123 
126  typedef std::lock_guard<std::mutex> lock_t;
127 
129  ::TVirtualPerfStats* m_otherPerfStats;
130 
132  bool m_running;
134  ::Double_t m_startTime;
135 
137  ::TTree* m_tree;
139  ::TFile* m_file;
140 
143 
144  ClassDef( xAOD::PerfStats, 0 )
145 
146  }; // class PerfStats
147 
148 } // namespace xAOD
149 
150 #endif // XAODCORE_TOOLS_PERFSTATS_H
xAOD::PerfStats::PerfStats
PerfStats()
The constructor is protected, as it's a singleton.
xAOD::PerfStats::UnzipEvent
virtual void UnzipEvent(::TObject *tree, ::Long64_t pos, ::Double_t start, ::Int_t complen, ::Int_t objlen)
Function called in general when a file unzipping operation happens.
xAOD::PerfStats::lock_t
std::lock_guard< std::mutex > lock_t
Definition: PerfStats.h:126
xAOD::PerfStats::SetUsed
virtual void SetUsed(size_t bi, size_t basketNumber)
xAOD::PerfStats::start
void start(bool clear=true)
Start the statistics collection.
xAOD::PerfStats::UpdateBranchIndices
virtual void UpdateBranchIndices(TObjArray *branches)
Update the fBranchIndexCache collection to match the current TTree given the ordered list of branch n...
xAOD::PerfStats::m_treeWarningPrinted
bool m_treeWarningPrinted
Flag showing whether some information message has already been printed.
Definition: PerfStats.h:142
BeamSpot::mutex
std::mutex mutex
Definition: InDetBeamSpotVertex.cxx:18
xAOD::PerfStats::FileOpenEvent
virtual void FileOpenEvent(::TFile *file, const char *filename, ::Double_t start)
Function called by PROOF when a file is opened.
tree
TChain * tree
Definition: tile_monitor.h:30
xAOD::PerfStats::FileEvent
virtual void FileEvent(const char *slave, const char *slavename, const char *nodename, const char *filename, ::Bool_t isStart)
PROOF specific function, not implemented here.
xAOD::PerfStats::PrintBasketInfo
virtual void PrintBasketInfo(Option_t *option="") const
Print the TTree basket read caching statistics.
xAOD::PerfStats::SetLoadedMiss
virtual void SetLoadedMiss(size_t bi, size_t basketNumber)
xAOD::PerfStats::GetNumEvents
virtual ::Long64_t GetNumEvents() const
Function used by PROOF to set the number of processed events correctly.
xAOD::PerfStats::FileReadEvent
virtual void FileReadEvent(::TFile *file, ::Int_t len, ::Double_t start)
Function called in general when a file reading operation happens.
xAOD
ICaloAffectedTool is abstract interface for tools checking if 4 mom is in calo affected region.
Definition: ICaloAffectedTool.h:24
xAOD::PerfStats
Class for collecting information about the xAOD file access pattern.
Definition: PerfStats.h:34
xAOD::PerfStats::SetLoaded
virtual void SetLoaded(size_t bi, size_t basketNumber)
xAOD::PerfStats::~PerfStats
~PerfStats()
Destructor, sometimes called by PROOF.
xAOD::PerfStats::ATLAS_THREAD_SAFE
static PerfStats *s_instance ATLAS_THREAD_SAFE
The single instance of the object.
Definition: PerfStats.h:122
xAOD::PerfStats::PacketEvent
virtual 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)
PROOF specific function, not implemented here.
runLayerRecalibration.branches
list branches
Definition: runLayerRecalibration.py:98
xAOD::PerfStats::SetUsed
virtual void SetUsed(TBranch *b, size_t basketNumber)
Mark a basket as accessed.
xAOD::PerfStats::SetLoadedMiss
virtual void SetLoadedMiss(TBranch *b, size_t basketNumber)
Increase by 1 the counter of how many times a basket was cached on access.
xAOD::PerfStats::m_file
::TFile * m_file
The currently open xAOD file.
Definition: PerfStats.h:139
xAOD::PerfStats::SimpleEvent
virtual void SimpleEvent(EEventType type)
Generic function called when a specified event happens.
xAOD::PerfStats::RateEvent
virtual void RateEvent(::Double_t proctime, ::Double_t deltatime, ::Long64_t eventsprocessed, ::Long64_t bytesRead)
PROOF specific function, not implemented here.
file
TFile * file
Definition: tile_monitor.h:29
xAOD::PerfStats::SetMissed
virtual void SetMissed(TBranch *b, size_t basketNumber)
Increase count (by 1) of not cached basket reads.
xAOD::PerfStats::GetBytesRead
virtual ::Long64_t GetBytesRead() const
Function used by PROOF to set the read bytes correctly on the master.
trigbs_pickEvents.num
num
Definition: trigbs_pickEvents.py:76
xAOD::PerfStats::SetLoaded
virtual void SetLoaded(TBranch *b, size_t basketNumber)
Increase by 1 the counter of how many times a basket was cached.
plotBeamSpotMon.b
b
Definition: plotBeamSpotMon.py:77
xAOD::PerfStats::s_mutex
static std::mutex s_mutex
Lock controlling access to the singleton.
Definition: PerfStats.h:125
xAOD::PerfStats::SetBytesRead
virtual void SetBytesRead(::Long64_t num)
Function used by PROOF to set the read bytes correctly on the master.
xAOD::PerfStats::instance
static PerfStats & instance()
Function accessing the singleton instance.
python.LumiBlobConversion.pos
pos
Definition: LumiBlobConversion.py:18
VKalVrtAthena::varHolder_detail::clear
void clear(T &var)
Definition: NtupleVars.h:48
xAOD::PerfStats::SetMissed
virtual void SetMissed(size_t bi, size_t basketNumber)
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
CaloCellTimeCorrFiller.filename
filename
Definition: CaloCellTimeCorrFiller.py:24
xAOD::PerfStats::m_running
bool m_running
Flag showing whether the statistic collection is ongoing or not.
Definition: PerfStats.h:132
xAOD::PerfStats::m_otherPerfStats
::TVirtualPerfStats * m_otherPerfStats
Another performance monitoring object.
Definition: PerfStats.h:129
xAOD::PerfStats::stop
void stop()
Stop the statistics collection.
xAOD::PerfStats::SetNumEvents
virtual void SetNumEvents(::Long64_t num)
Function used by PROOF to set the number of processed events correctly.
xAOD::PerfStats::m_tree
::TTree * m_tree
The tree we're currently investigating.
Definition: PerfStats.h:137
xAOD::PerfStats::m_startTime
::Double_t m_startTime
Time when the statistics collection was started.
Definition: PerfStats.h:134
checker_macros.h
Define macros for attributes used to control the static checker.
xAOD::PerfStats::SetFile
virtual void SetFile(TFile *file)
Function letting us know that a new file was opened.