ATLAS Offline Software
Loading...
Searching...
No Matches
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):
18class TTree;
19
20namespace xAOD {
21
34 class PerfStats : public ::TVirtualPerfStats {
35
36 public:
39
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 )
118 virtual void SetFile( TFile* file );
119#endif // ROOT version
120
122 static PerfStats* s_instance ATLAS_THREAD_SAFE;
123
125 static std::mutex s_mutex;
126 typedef std::lock_guard<std::mutex> lock_t;
127
129 ::TVirtualPerfStats* m_otherPerfStats;
130
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
Define macros for attributes used to control the static checker.
Class for collecting information about the xAOD file access pattern.
Definition PerfStats.h:34
virtual void SetMissed(size_t bi, size_t basketNumber)
::TTree * m_tree
The tree we're currently investigating.
Definition PerfStats.h:137
virtual void FileOpenEvent(::TFile *file, const char *filename, ::Double_t start)
Function called by PROOF when a file is opened.
~PerfStats()
Destructor, sometimes called by PROOF.
virtual void SimpleEvent(EEventType type)
Generic function called when a specified event happens.
virtual void SetLoaded(TBranch *b, size_t basketNumber)
Increase by 1 the counter of how many times a basket was cached.
virtual void SetNumEvents(::Long64_t num)
Function used by PROOF to set the number of processed events correctly.
virtual::Long64_t GetNumEvents() const
Function used by PROOF to set the number of processed events correctly.
void stop()
Stop the statistics collection.
virtual void FileEvent(const char *slave, const char *slavename, const char *nodename, const char *filename, ::Bool_t isStart)
PROOF specific function, not implemented here.
::TVirtualPerfStats * m_otherPerfStats
Another performance monitoring object.
Definition PerfStats.h:129
static std::mutex s_mutex
Lock controlling access to the singleton.
Definition PerfStats.h:125
::TFile * m_file
The currently open xAOD file.
Definition PerfStats.h:139
std::lock_guard< std::mutex > lock_t
Definition PerfStats.h:126
virtual void SetLoaded(size_t bi, size_t basketNumber)
virtual void SetBytesRead(::Long64_t num)
Function used by PROOF to set the read bytes correctly on the master.
void start(bool clear=true)
Start the statistics collection.
static PerfStats & instance()
Function accessing the singleton instance.
virtual void UpdateBranchIndices(TObjArray *branches)
Update the fBranchIndexCache collection to match the current TTree given the ordered list of branch n...
::Double_t m_startTime
Time when the statistics collection was started.
Definition PerfStats.h:134
virtual void SetLoadedMiss(size_t bi, size_t basketNumber)
virtual void SetMissed(TBranch *b, size_t basketNumber)
Increase count (by 1) of not cached basket reads.
virtual void SetUsed(size_t bi, size_t basketNumber)
bool m_running
Flag showing whether the statistic collection is ongoing or not.
Definition PerfStats.h:132
virtual void PrintBasketInfo(Option_t *option="") const
Print the TTree basket read caching statistics.
static PerfStats *s_instance ATLAS_THREAD_SAFE
The single instance of the object.
Definition PerfStats.h:122
virtual void SetFile(TFile *file)
Function letting us know that a new file was opened.
PerfStats()
The constructor is protected, as it's a singleton.
virtual void FileReadEvent(::TFile *file, ::Int_t len, ::Double_t start)
Function called in general when a file reading operation happens.
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.
virtual::Long64_t GetBytesRead() const
Function used by PROOF to set the read bytes correctly on the master.
virtual void RateEvent(::Double_t proctime, ::Double_t deltatime, ::Long64_t eventsprocessed, ::Long64_t bytesRead)
PROOF specific function, not implemented here.
virtual void SetUsed(TBranch *b, size_t basketNumber)
Mark a basket as accessed.
bool m_treeWarningPrinted
Flag showing whether some information message has already been printed.
Definition PerfStats.h:142
virtual void SetLoadedMiss(TBranch *b, size_t basketNumber)
Increase by 1 the counter of how many times a basket was cached on access.
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.
ICaloAffectedTool is abstract interface for tools checking if 4 mom is in calo affected region.
TChain * tree
TFile * file