|
1 | 1 | #ifndef HLTrigger_Timer_interface_ProcessCallGraph_h |
2 | 2 | #define HLTrigger_Timer_interface_ProcessCallGraph_h |
3 | 3 |
|
4 | | -/* |
5 | | - * |
6 | | - */ |
7 | | - |
8 | | -#include <iostream> |
| 4 | +#include <memory> |
9 | 5 | #include <utility> |
10 | 6 | #include <vector> |
11 | 7 | #include <string> |
12 | | -#include <type_traits> |
13 | 8 |
|
14 | 9 | // boost optional (used by boost graph) results in some false positives with -Wmaybe-uninitialized |
15 | 10 | #pragma GCC diagnostic push |
|
20 | 15 | #pragma GCC diagnostic pop |
21 | 16 |
|
22 | 17 | #include "DataFormats/Provenance/interface/ModuleDescription.h" |
23 | | -#include "FWCore/ServiceRegistry/interface/PathsAndConsumesOfModulesBase.h" |
24 | | -#include "FWCore/ServiceRegistry/interface/ProcessContext.h" |
| 18 | +#include "FWCore/ServiceRegistry/interface/ServiceRegistryfwd.h" |
25 | 19 | #include "HLTrigger/Timer/interface/EDMModuleType.h" |
26 | 20 |
|
27 | 21 | class ProcessCallGraph { |
28 | 22 | public: |
29 | 23 | struct NodeType { |
30 | 24 | edm::ModuleDescription module_; |
31 | | - edm::EDMModuleType type_; |
| 25 | + edm::EDMModuleType type_ = edm::EDMModuleType::kUnknown; |
32 | 26 | bool scheduled_ = false; |
33 | 27 | }; |
34 | 28 |
|
@@ -64,61 +58,28 @@ class ProcessCallGraph { |
64 | 58 | modules_on_path_(std::move(mop)), |
65 | 59 | modules_and_dependencies_(std::move(mad)), |
66 | 60 | last_dependency_of_module_(std::move(ldom)) {} |
67 | | - |
68 | | - PathType(PathType const &other) = default; |
69 | | - |
70 | | - PathType(PathType &&other) = default; |
71 | | - |
72 | | - ~PathType() = default; |
73 | | - |
74 | | - PathType &operator=(PathType const &other) = default; |
75 | 61 | }; |
76 | 62 |
|
77 | | - // store the details of each process: name, modules call subgraph, modules, paths and endpaths, subprocess pids |
| 63 | + // store the details of the process: name, modules call subgraph, modules, paths and endpaths |
78 | 64 | struct ProcessType { |
79 | 65 | std::string name_; |
80 | 66 | GraphType const &graph_; |
81 | 67 | std::vector<unsigned int> modules_; |
82 | 68 | std::vector<PathType> paths_; |
83 | 69 | std::vector<PathType> endPaths_; |
84 | | - std::vector<unsigned int> subprocesses_; |
85 | | - |
86 | | - ProcessType() = delete; |
87 | 70 |
|
88 | 71 | ProcessType(std::string name, |
89 | 72 | GraphType const &graph, |
90 | 73 | std::vector<unsigned int> modules, |
91 | 74 | std::vector<PathType> paths, |
92 | | - std::vector<PathType> endPaths, |
93 | | - std::vector<unsigned int> subprocesses = {}) |
94 | | - : name_(std::move(name)), |
95 | | - graph_(graph), |
96 | | - modules_(std::move(modules)), |
97 | | - paths_(std::move(paths)), |
98 | | - endPaths_(std::move(endPaths)), |
99 | | - subprocesses_(std::move(subprocesses)) {} |
100 | | - |
101 | | - ProcessType(std::string &&name, |
102 | | - GraphType const &graph, |
103 | | - std::vector<unsigned int> &&modules, |
104 | | - std::vector<PathType> &&paths, |
105 | | - std::vector<PathType> &&endPaths, |
106 | | - std::vector<unsigned int> &&subprocesses = {}) |
| 75 | + std::vector<PathType> endPaths) |
107 | 76 | : name_(std::move(name)), |
108 | 77 | graph_(graph), |
109 | 78 | modules_(std::move(modules)), |
110 | 79 | paths_(std::move(paths)), |
111 | | - endPaths_(std::move(endPaths)), |
112 | | - subprocesses_(std::move(subprocesses)) {} |
113 | | - |
114 | | - ProcessType(ProcessType const &other) = default; |
115 | | - ProcessType(ProcessType &&other) = default; |
116 | | - |
117 | | - ProcessType &operator=(ProcessType const &other) = delete; |
118 | | - ProcessType &operator=(ProcessType &&other) = delete; |
| 80 | + endPaths_(std::move(endPaths)) {} |
119 | 81 | }; |
120 | 82 |
|
121 | | -public: |
122 | 83 | // default c'tor |
123 | 84 | ProcessCallGraph() = default; |
124 | 85 |
|
@@ -146,39 +107,17 @@ class ProcessCallGraph { |
146 | 107 | // find the dependencies of all modules in the given path |
147 | 108 | std::pair<std::vector<unsigned int>, std::vector<unsigned int>> dependencies(std::vector<unsigned int> const &path); |
148 | 109 |
|
149 | | - // retrieve the "process id" of a process, given its ProcessContex |
150 | | - unsigned int processId(edm::ProcessContext const &) const; |
151 | | - |
152 | | - // retrieve the "process id" of a process, given its name |
153 | | - unsigned int processId(std::string const &) const; |
154 | | - |
155 | | - // retrieve the processes |
156 | | - std::vector<ProcessType> const &processes() const; |
157 | | - |
158 | | - // retrieve information about a process, given its "process id" |
159 | | - ProcessType const &processDescription(unsigned int) const; |
160 | | - |
161 | | - // retrieve information about a process, given its ProcessContex |
162 | | - ProcessType const &processDescription(edm::ProcessContext const &) const; |
163 | | - |
164 | | - // retrieve information about a process, given its name |
165 | | - ProcessType const &processDescription(std::string const &) const; |
166 | | - |
167 | | -private: |
168 | | - // register a (sub)process and assigns it a "process id" |
169 | | - unsigned int registerProcess(edm::ProcessContext const &); |
| 110 | + // retrieve information about the process |
| 111 | + ProcessType const &processDescription() const; |
170 | 112 |
|
171 | 113 | private: |
172 | 114 | GraphType graph_; |
173 | 115 |
|
174 | 116 | // module id of the Source |
175 | 117 | unsigned int source_ = edm::ModuleDescription::invalidID(); |
176 | 118 |
|
177 | | - // map each (sub)process name to a "process id" |
178 | | - std::unordered_map<std::string, unsigned int> process_id_; |
179 | | - |
180 | | - // description of each process |
181 | | - std::vector<ProcessType> process_description_; |
| 119 | + // description of the process |
| 120 | + std::unique_ptr<ProcessType> process_description_; |
182 | 121 | }; |
183 | 122 |
|
184 | 123 | #endif // not defined HLTrigger_Timer_interface_ProcessCallGraph_h |
0 commit comments