The Gaudi Framework  master (da3d77e1)
RootPerfMonSvc.h
Go to the documentation of this file.
1 /***********************************************************************************\
2 * (c) Copyright 1998-2024 CERN for the benefit of the LHCb and ATLAS collaborations *
3 * *
4 * This software is distributed under the terms of the Apache version 2 licence, *
5 * copied verbatim in the file "LICENSE". *
6 * *
7 * In applying this licence, CERN does not waive the privileges and immunities *
8 * granted to it by virtue of its status as an Intergovernmental Organization *
9 * or submit itself to any jurisdiction. *
10 \***********************************************************************************/
11 //====================================================================
12 // RootPerfMonSvc definition
13 //--------------------------------------------------------------------
14 //
15 // Author : M.Frank
16 //====================================================================
17 #ifndef GAUDIROOTCNV_GAUDIROOTPERFMONSVC_H
18 #define GAUDIROOTCNV_GAUDIROOTPERFMONSVC_H
19 
20 #include <memory>
21 // Framework include files
24 #include <GaudiKernel/Service.h>
25 
26 #include <TFile.h>
27 #include <TTree.h>
28 
29 #include <RootCnv/SysProcStat.h>
30 
31 // C/C++ include files
32 #include <set>
33 
34 /*
35  * Gaudi namespace declaration
36  */
37 namespace Gaudi {
38 
49  class GAUDI_API RootPerfMonSvc : public extends<Service, IIncidentListener> {
50  protected:
52  this, "IOPerfStats", "", "Enable TTree IOperfStats if not empty; otherwise perf stat file name" };
53  // Passed parameters
54  Gaudi::Property<std::string> m_setStreams{ this, "Streams", "", "" };
55  Gaudi::Property<std::string> m_basketSize{ this, "BasketSize", "", "" };
56  Gaudi::Property<std::string> m_bufferSize{ this, "BufferSize", "", "" };
57  Gaudi::Property<std::string> m_splitLevel{ this, "SplitLevel", "", "" };
58 
63  // Reference to a tree with statistics
64  TTree* m_perfTree;
65  // Reference to a file where statistics are persisted
67  // Reference to all connected output files
69  // The newest observed values
70  Int_t m_eventType;
71  ULong_t m_utime, m_stime, m_vsize;
72  Long_t m_eventNumber, m_rss, m_time;
73 
74  // Types of records
75  enum EventType { EVENT = 1, FSR = 2 };
76 
77  // Adding newest observed values to the tree with statistics
78  virtual void record( EventType eventType );
79 
81  MsgStream& log() const { return *m_log; }
82 
83  public:
85  using extends::extends;
86 
92  StatusCode error( const std::string& msg );
93 
95  StatusCode initialize() override;
96 
98  StatusCode finalize() override;
99 
101  void handle( const Incident& incident ) override;
102 
103  // Service overload: Stop the service
104  StatusCode stop() override;
105  };
106 } // namespace Gaudi
107 
108 #endif // GAUDIROOTCNV_GAUDIROOTPERFMONSVC_H
Gaudi::RootPerfMonSvc::m_perfTree
TTree * m_perfTree
Definition: RootPerfMonSvc.h:64
std::string
STL class.
Gaudi::RootPerfMonSvc::m_incidentSvc
SmartIF< IIncidentSvc > m_incidentSvc
Reference to incident service.
Definition: RootPerfMonSvc.h:60
GaudiMP.FdsRegistry.msg
msg
Definition: FdsRegistry.py:19
Gaudi::RootPerfMonSvc::m_outputs
std::set< std::string > m_outputs
Definition: RootPerfMonSvc.h:68
Gaudi::RootPerfMonSvc
Definition: RootPerfMonSvc.h:49
Gaudi::RootPerfMonSvc::m_log
std::unique_ptr< MsgStream > m_log
Message streamer.
Definition: RootPerfMonSvc.h:62
Gaudi::RootPerfMonSvc::m_perfFile
std::unique_ptr< TFile > m_perfFile
Definition: RootPerfMonSvc.h:66
Gaudi::RootPerfMonSvc::m_eventType
Int_t m_eventType
Definition: RootPerfMonSvc.h:70
IIncidentSvc.h
SysProcStat.h
StatusCode
Definition: StatusCode.h:65
Gaudi::RootPerfMonSvc::m_time
Long_t m_time
Definition: RootPerfMonSvc.h:72
Gaudi::RootPerfMonSvc::log
MsgStream & log() const
Helper: Use message streamer.
Definition: RootPerfMonSvc.h:81
SmartIF< IIncidentSvc >
extends
Base class used to extend a class implementing other interfaces.
Definition: extends.h:20
MsgStream
Definition: MsgStream.h:33
Gaudi
This file provides a Grammar for the type Gaudi::Accumulators::Axis It allows to use that type from p...
Definition: __init__.py:1
Service.h
IIncidentListener.h
Gaudi::RootPerfMonSvc::m_vsize
ULong_t m_vsize
Definition: RootPerfMonSvc.h:71
Gaudi::RootPerfMonSvc::EventType
EventType
Definition: RootPerfMonSvc.h:75
Incident
Definition: Incident.h:27
std::unique_ptr< MsgStream >
std::set< std::string >
GAUDI_API
#define GAUDI_API
Definition: Kernel.h:81
Gaudi::Property< std::string >