From b2781900247620ac825a3f782fb7a0c171f3d174 Mon Sep 17 00:00:00 2001 From: Giulio Eulisse <10544+ktf@users.noreply.github.com> Date: Thu, 18 Jan 2024 12:36:12 +0100 Subject: [PATCH] DPL: improve debugging of WorkflowImporter Using Signposts allow us to have a nested view of the state processing. --- .../Core/src/WorkflowSerializationHelpers.cxx | 23 ++++++++++++------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/Framework/Core/src/WorkflowSerializationHelpers.cxx b/Framework/Core/src/WorkflowSerializationHelpers.cxx index ac182a27a70c5..e20e23f98c90b 100644 --- a/Framework/Core/src/WorkflowSerializationHelpers.cxx +++ b/Framework/Core/src/WorkflowSerializationHelpers.cxx @@ -18,6 +18,7 @@ #include "Framework/DataDescriptorMatcher.h" #include "Framework/DataMatcherWalker.h" #include "Framework/Logger.h" +#include "Framework/Signpost.h" #include #include @@ -27,6 +28,8 @@ #include #include +O2_DECLARE_DYNAMIC_LOG(workflow_importer); + namespace o2::framework { @@ -811,7 +814,7 @@ struct WorkflowImporter : public rapidjson::BaseReaderHandler, bool Uint(unsigned i) { - debug << "Uint(" << i << ")" << std::endl; + O2_SIGNPOST_EVENT_EMIT(workflow_importer, _o2_signpost_id_t{(int64_t)states.size()}, "import", "Uint(%d)", i); if (in(State::IN_INPUT_SUBSPEC)) { subspec = i; inputMatcherNodes.push_back(SubSpecificationTypeValueMatcher{i}); @@ -845,28 +848,31 @@ struct WorkflowImporter : public rapidjson::BaseReaderHandler, bool Int(int i) { - debug << "Int(" << i << ")" << std::endl; + O2_SIGNPOST_EVENT_EMIT(workflow_importer, _o2_signpost_id_t{(int64_t)states.size()}, "import", "Int(%d)", i); return true; } bool Uint64(uint64_t u) { - debug << "Uint64(" << u << ")" << std::endl; + O2_SIGNPOST_EVENT_EMIT(workflow_importer, _o2_signpost_id_t{(int64_t)states.size()}, "import", "Uint64(%" PRIu64 ")", u); return true; } bool Double(double d) { - debug << "Double(" << d << ")" << std::endl; + O2_SIGNPOST_EVENT_EMIT(workflow_importer, _o2_signpost_id_t{(int64_t)states.size()}, "import", "Double(%f)", d); return true; } void enter(char const* what) { - debug << "ENTER: " << what << std::endl; + O2_SIGNPOST_EVENT_EMIT(workflow_importer, _o2_signpost_id_t{(int64_t)states.size()}, "import", "ENTER: %s", what); } + void push(State state) { - debug << "PUSH: " << state << std::endl; + debug.str(""); + debug << state; states.push_back(state); + O2_SIGNPOST_START(workflow_importer, _o2_signpost_id_t{(int64_t)states.size()}, "import", "PUSH: %s", debug.str().c_str()); } State pop() @@ -877,11 +883,12 @@ struct WorkflowImporter : public rapidjson::BaseReaderHandler, } auto result = states.back(); states.pop_back(); - debug << "POP: " << result; + debug.str(""); + debug << result; if (!states.empty()) { debug << " now in " << states.back(); } - debug << std::endl; + O2_SIGNPOST_END(workflow_importer, _o2_signpost_id_t{(int64_t)states.size()+1}, "import", "POP: %s", debug.str().c_str()); return result; } bool in(State o)