12 #pragma GCC diagnostic push
13 #pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
14 #include <boost/graph/depth_first_search.hpp>
15 #pragma GCC diagnostic pop
38 using std::pair<I, I>::pair;
72 boost::get_property(graph, boost::graph_name) = context.
processName();
76 for (
size_t i = 0;
i <
size; ++
i)
77 boost::add_vertex(graph);
80 std::vector<unsigned int>
modules;
81 modules.reserve(size);
99 size = pathsAndConsumes.
paths().size();
101 std::vector<PathType>
paths;
103 for (
unsigned int i = 0;
i <
size; ++
i) {
104 std::vector<unsigned int>
modules;
113 size = pathsAndConsumes.
endPaths().size();
114 std::vector<PathType> endPaths;
115 endPaths.reserve(size);
116 for (
unsigned int i = 0;
i <
size; ++
i) {
117 std::vector<unsigned int>
modules;
156 std::vector<unsigned int>
colors(boost::num_vertices(
graph_));
157 auto colormap = boost::make_container_vertex_map(colors);
160 boost::default_dfs_visitor visitor;
161 boost::depth_first_visit(
graph_, module, visitor, colormap);
165 unsigned int size = 0;
166 for (
unsigned int color : colors)
167 if (boost::black_color == color)
171 for (
unsigned int i = 0;
i < colors.size(); ++
i)
172 if (boost::black_color == colors[
i])
173 dependencies[j++] =
i;
185 std::vector<unsigned int>
const&
path) {
186 std::vector<unsigned int>
colors(boost::num_vertices(
graph_));
187 auto colormap = boost::make_container_vertex_map(colors);
190 boost::default_dfs_visitor visitor;
191 for (
unsigned int module : path)
192 boost::depth_first_visit(
graph_,
module, visitor, colormap);
194 unsigned int size = 0;
195 for (
unsigned int color : colors)
201 dependencies.resize(0);
202 std::vector<unsigned int>
indices(path.size());
206 for (
unsigned int& color : colors)
210 struct record_vertices : boost::default_dfs_visitor {
211 record_vertices(std::vector<unsigned int>&
vertices) : vertices_(vertices) {}
213 void discover_vertex(
unsigned int vertex,
GraphType const& graph) { vertices_.push_back(vertex); }
215 std::vector<unsigned int>& vertices_;
217 record_vertices recorder(dependencies);
219 for (
unsigned int module : path) {
221 if (colors[
module] != boost::black_color)
222 boost::depth_first_visit(
graph_,
module, recorder, colormap);
223 indices.push_back(dependencies.size());
226 return std::make_pair(dependencies,
indices);
232 static unsigned int s_id = 0;
237 <<
"ProcessCallGraph::preBeginJob(): called for subprocess \"" << context.
processName() <<
"\""
245 <<
"ProcessCallGraph::preBeginJob(): called twice for the same "
259 <<
"ProcessCallGraph::processId(): unexpected " << (context.
isSubProcess() ?
"subprocess" :
"process") <<
" "
270 <<
"ProcessCallGraph::processId(): unexpected (sub)process " <<
processName;
290 unsigned int pid =
processId(processName);
pathNames_ & tns()), endPathNames_(&tns.getEndPaths()), wantSummary_(tns.wantSummary()
unsigned int registerProcess(edm::ProcessContext const &)
std::string const & processName() const
std::string const & getTrigPath(size_type const i) const
unsigned int largestModuleID() const
unsigned int processId(edm::ProcessContext const &) const
std::unordered_map< std::string, unsigned int > process_id_
iterator_pair_as_a_range< I > make_range(std::pair< I, I > p)
std::vector< ModuleDescription const * > const & modulesOnEndPath(unsigned int endPathIndex) const
std::vector< ModuleDescription const * > const & modulesOnPath(unsigned int pathIndex) const
edm::ModuleDescription const & source() const
ProcessContext const & parentProcessContext() const
std::vector< ModuleDescription const * > const & allModules() const
EDMModuleType edmModuleTypeEnum(edm::ModuleDescription const &module)
std::vector< std::string > const & endPaths() const
U second(std::pair< T, U > const &p)
void preBeginJob(edm::PathsAndConsumesOfModulesBase const &, edm::ProcessContext const &)
std::vector< ProcessType > const & processes() const
ProcessType const & processDescription(unsigned int) const
const std::complex< double > I
void preSourceConstruction(edm::ModuleDescription const &)
std::vector< ProcessType > process_description_
std::vector< ModuleDescription const * > const & modulesWhoseProductsAreConsumedBy(unsigned int moduleID, BranchType branchType=InEvent) const
std::vector< unsigned int > depends(unsigned int module) const
std::string const & getEndPath(size_type const i) const
Strings const & getTrigPaths() const
std::vector< std::string > const & paths() const
std::pair< std::vector< unsigned int >, std::vector< unsigned int > > dependencies(std::vector< unsigned int > const &path)
unsigned int size() const
edm::ModuleDescription const & module(unsigned int module) const
bool isSubProcess() const
boost::subgraph< boost::adjacency_list< boost::vecS, boost::vecS, boost::directedS, NodeType, boost::property< boost::edge_index_t, int >, boost::property< boost::graph_name_t, std::string >>> GraphType
NodeType const & operator[](unsigned int module) const