33 const std::set<std::string>& pipeline_enabled_node_names,
34 uint64_t pipeline_heartbeat,
35 bool multiple_triggers,
37 pipeline_collection_path_(pipeline_collection_path),
38 pipeline_enabled_node_names_(pipeline_enabled_node_names),
39 pipeline_heartbeat_(pipeline_heartbeat),
40 multiple_triggers_(multiple_triggers),
45 sparta_assert(!multiple_triggers_,
"The --debug-on-roi option is not supported yet in MAP v3");
57 sparta_assert(!triggered_,
"Why has pipeline trigger been triggered?");
59 std::cout <<
"Pipeline collection started, writing to database file '"
60 << pipeline_collector_->getFilePath() <<
"'" << std::endl;
63 if(multiple_triggers_) {
64 std::cout <<
"#" << num_collections_ <<
" pipeline collection started" << std::endl;
70 sparta_assert(triggered_,
"Why stop an inactivated trigger?");
74 if(multiple_triggers_) {
75 std::cout <<
"#" << num_collections_ <<
" pipeline collection ended" << std::endl;
77 pipeline_collector_->reactivate(getCollectionPath_());
82 void startCollection_()
84 if(pipeline_enabled_node_names_.empty()) {
86 pipeline_collector_->startCollection(root_);
90 for(
const auto & node_name : pipeline_enabled_node_names_) {
91 std::vector<TreeNode*> results;
93 if(results.size() == 0) {
94 std::cerr << SPARTA_CURRENT_COLOR_RED
95 <<
"WARNING (Pipeline collection): Could not find node named: '"
97 <<
"' Collection will not occur on that node!"
101 for(
auto & tn : results) {
102 std::cout <<
"Collection enabled on node: '" << tn->getLocation() <<
"'" << std::endl;
103 pipeline_collector_->startCollection(tn);
109 void stopCollection_()
111 if(pipeline_enabled_node_names_.empty()) {
113 pipeline_collector_->stopCollection(root_);
117 for(
const auto & node_name : pipeline_enabled_node_names_) {
118 std::vector<TreeNode*> results;
120 for(
auto & tn : results) {
121 pipeline_collector_->stopCollection(tn);
125 pipeline_collector_->destroy();
128 std::string getCollectionPath_()
const
130 if(pipeline_collection_path_.back() ==
'/') {
131 return pipeline_collection_path_ + std::to_string(num_collections_) +
'_';
134 return pipeline_collection_path_ +
'_' + std::to_string(num_collections_) +
'_';
138 std::unique_ptr<collection::PipelineCollector> pipeline_collector_;
139 const std::string pipeline_collection_path_;
140 const std::set<std::string> pipeline_enabled_node_names_;
141 const uint64_t pipeline_heartbeat_;
142 const bool multiple_triggers_;
145 uint32_t num_collections_ = 0;