The Gaudi Framework  v33r1 (b1225454)
RootPerfMonSvc.h
Go to the documentation of this file.
1 /***********************************************************************************\
2 * (c) Copyright 1998-2019 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:
51  Gaudi::Property<std::string> m_ioPerfStats{this, "IOPerfStats", "",
52  "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
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:34
Implementation of property with value of concrete type.
Definition: Property.h:370
std::unique_ptr< TFile > m_perfFile
MsgStream & log() const
Helper: Use message streamer.
SmartIF< IIncidentSvc > m_incidentSvc
Reference to incident service.
STL class.
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:61
Base class used to extend a class implementing other interfaces.
Definition: extends.h:20
Base class for all Incidents (computing events).
Definition: Incident.h:27
std::set< std::string > m_outputs
#define GAUDI_API
Definition: Kernel.h:81
std::unique_ptr< MsgStream > m_log
Message streamer.
Header file for std:chrono::duration-based Counters.
Definition: __init__.py:1