ATLAS Offline Software
CallGraphBuilderSvc.h
Go to the documentation of this file.
1 
3 /*
4  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
5 */
6 
7 // CallGraphBuilderSvc.h
8 // Header file for class CallGraphBuilderSvc
9 // Author: S.Binet<binet@cern.ch>
11 #ifndef PERFMONCOMPS_CALLGRAPHBUILDERSVC_H
12 #define PERFMONCOMPS_CALLGRAPHBUILDERSVC_H
13 
14 // STL includes
15 #include <mutex>
16 #include <string>
17 #include <stack>
18 
19 // boost includes
20 //Remove in boost > 1.76 when the boost iterator issue
21 //is solved see ATLASRECTS-6358
22 #define BOOST_ALLOW_DEPRECATED_HEADERS
23 #include <boost/graph/adjacency_list.hpp>
24 
25 // FrameWork includes
28 #include "GaudiKernel/MsgStream.h"
29 #include "GaudiKernel/HashMap.h"
30 
31 // PerfMonKernel includes
33 
34 // Forward declaration
35 class ISvcLocator;
36 template <class TYPE> class SvcFactory;
37 
38 namespace PerfMon {
39 
41  public AthService
42 {
43 
44 protected:
45 
46  friend class SvcFactory<CallGraphBuilderSvc>;
47 
49  // Public typedefs:
51  public:
52  typedef unsigned long NodeId_t;
53 
55  // Public methods:
57  public:
58 
59  // Copy constructor:
60 
62  CallGraphBuilderSvc( const std::string& name, ISvcLocator* pSvcLocator );
63 
65  virtual ~CallGraphBuilderSvc();
66 
68 
71  virtual StatusCode queryInterface( const InterfaceID& riid,
72  void** ppvInterface );
74 
75 
77  // Non-const methods:
79 
80  static const InterfaceID& interfaceID();
81 
83  void openNode( const std::string& nodeName );
84 
86  void closeNode( const std::string& nodeName );
87 
89  // Private data:
91  private:
92 
95 
97  std::recursive_mutex m_mutex;
98 
101 
103  GaudiUtils::HashMap<std::string, NodeId_t> m_nameToId ATLAS_THREAD_SAFE;
105  GaudiUtils::HashMap<NodeId_t, std::string> m_idToName ATLAS_THREAD_SAFE;
106 
108  std::stack<NodeId_t> m_stack ATLAS_THREAD_SAFE;
109 
110  typedef boost::adjacency_list<> CallGraph_t;
113 
114 };
115 
116 
120 
121 inline const InterfaceID& CallGraphBuilderSvc::interfaceID()
122 {
124 }
125 
126 } // end namespace PerfMon
127 
128 #endif //> PERFMONCOMPS_CALLGRAPHBUILDERSVC_H
PerfMon::CallGraphBuilderSvc::m_mutex
std::recursive_mutex m_mutex
Mutex protecting the following members.
Definition: CallGraphBuilderSvc.h:97
PerfMon::CallGraphBuilderSvc::ATLAS_THREAD_SAFE
GaudiUtils::HashMap< NodeId_t, std::string > m_idToName ATLAS_THREAD_SAFE
UUID-to-Method-name.
Definition: CallGraphBuilderSvc.h:105
PerfMon::CallGraphBuilderSvc::initialize
StatusCode initialize()
Gaudi Service Implementation.
Definition: CallGraphBuilderSvc.cxx:63
PerfMon::CallGraphBuilderSvc::queryInterface
virtual StatusCode queryInterface(const InterfaceID &riid, void **ppvInterface)
Definition: CallGraphBuilderSvc.cxx:100
PerfMon::CallGraphBuilderSvc
Definition: CallGraphBuilderSvc.h:42
SvcFactory
Definition: AthCnvSvc.h:28
PerfMon::CallGraphBuilderSvc::ATLAS_THREAD_SAFE
static NodeId_t m_uuid ATLAS_THREAD_SAFE
a "unique identifier" for node names
Definition: CallGraphBuilderSvc.h:100
PerfMon
a simple malloc wrapper that keeps track of the amount of memory allocated on the heap.
Definition: CallGraphAuditor.cxx:24
PerfMon::CallGraphBuilderSvc::interfaceID
static const InterfaceID & interfaceID()
Inline methods:
Definition: CallGraphBuilderSvc.h:121
PerfMon::CallGraphBuilderSvc::ATLAS_THREAD_SAFE
GaudiUtils::HashMap< std::string, NodeId_t > m_nameToId ATLAS_THREAD_SAFE
Method-name-to-UUID.
Definition: CallGraphBuilderSvc.h:103
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
AthService
Definition: AthService.h:32
ICallGraphBuilderSvc.h
PerfMon::CallGraphBuilderSvc::ATLAS_THREAD_SAFE
CallGraph_t m_graph ATLAS_THREAD_SAFE
the callgraph
Definition: CallGraphBuilderSvc.h:112
PerfMon::CallGraphBuilderSvc::openNode
void openNode(const std::string &nodeName)
open a new node in the call graph tree
Definition: CallGraphBuilderSvc.cxx:117
PerfMon::CallGraphBuilderSvc::finalize
StatusCode finalize()
Definition: CallGraphBuilderSvc.cxx:85
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
PerfMon::CallGraphBuilderSvc::CallGraphBuilderSvc
CallGraphBuilderSvc()
Default constructor:
ICallGraphBuilderSvc::interfaceID
static const InterfaceID & interfaceID()
Definition: ICallGraphBuilderSvc.h:60
PerfMon::CallGraphBuilderSvc::NodeId_t
unsigned long NodeId_t
Definition: CallGraphBuilderSvc.h:52
PerfMon::CallGraphBuilderSvc::closeNode
void closeNode(const std::string &nodeName)
close an existing node in the call graph tree
Definition: CallGraphBuilderSvc.cxx:139
AthService.h
PerfMon::CallGraphBuilderSvc::~CallGraphBuilderSvc
virtual ~CallGraphBuilderSvc()
Destructor:
Definition: CallGraphBuilderSvc.cxx:56
PerfMon::CallGraphBuilderSvc::CallGraph_t
boost::adjacency_list CallGraph_t
Definition: CallGraphBuilderSvc.h:110
checker_macros.h
Define macros for attributes used to control the static checker.
ICallGraphBuilderSvc
Definition: ICallGraphBuilderSvc.h:23
PerfMon::CallGraphBuilderSvc::ATLAS_THREAD_SAFE
std::stack< NodeId_t > m_stack ATLAS_THREAD_SAFE
stack of method names (in fact their uuid)
Definition: CallGraphBuilderSvc.h:108