Skip to content

Commit b278190

Browse files
committed
DPL: improve debugging of WorkflowImporter
Using Signposts allow us to have a nested view of the state processing.
1 parent a956817 commit b278190

File tree

1 file changed

+15
-8
lines changed

1 file changed

+15
-8
lines changed

Framework/Core/src/WorkflowSerializationHelpers.cxx

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#include "Framework/DataDescriptorMatcher.h"
1919
#include "Framework/DataMatcherWalker.h"
2020
#include "Framework/Logger.h"
21+
#include "Framework/Signpost.h"
2122

2223
#include <rapidjson/reader.h>
2324
#include <rapidjson/prettywriter.h>
@@ -27,6 +28,8 @@
2728
#include <algorithm>
2829
#include <memory>
2930

31+
O2_DECLARE_DYNAMIC_LOG(workflow_importer);
32+
3033
namespace o2::framework
3134
{
3235

@@ -811,7 +814,7 @@ struct WorkflowImporter : public rapidjson::BaseReaderHandler<rapidjson::UTF8<>,
811814

812815
bool Uint(unsigned i)
813816
{
814-
debug << "Uint(" << i << ")" << std::endl;
817+
O2_SIGNPOST_EVENT_EMIT(workflow_importer, _o2_signpost_id_t{(int64_t)states.size()}, "import", "Uint(%d)", i);
815818
if (in(State::IN_INPUT_SUBSPEC)) {
816819
subspec = i;
817820
inputMatcherNodes.push_back(SubSpecificationTypeValueMatcher{i});
@@ -845,28 +848,31 @@ struct WorkflowImporter : public rapidjson::BaseReaderHandler<rapidjson::UTF8<>,
845848

846849
bool Int(int i)
847850
{
848-
debug << "Int(" << i << ")" << std::endl;
851+
O2_SIGNPOST_EVENT_EMIT(workflow_importer, _o2_signpost_id_t{(int64_t)states.size()}, "import", "Int(%d)", i);
849852
return true;
850853
}
851854
bool Uint64(uint64_t u)
852855
{
853-
debug << "Uint64(" << u << ")" << std::endl;
856+
O2_SIGNPOST_EVENT_EMIT(workflow_importer, _o2_signpost_id_t{(int64_t)states.size()}, "import", "Uint64(%" PRIu64 ")", u);
854857
return true;
855858
}
856859
bool Double(double d)
857860
{
858-
debug << "Double(" << d << ")" << std::endl;
861+
O2_SIGNPOST_EVENT_EMIT(workflow_importer, _o2_signpost_id_t{(int64_t)states.size()}, "import", "Double(%f)", d);
859862
return true;
860863
}
861864

862865
void enter(char const* what)
863866
{
864-
debug << "ENTER: " << what << std::endl;
867+
O2_SIGNPOST_EVENT_EMIT(workflow_importer, _o2_signpost_id_t{(int64_t)states.size()}, "import", "ENTER: %s", what);
865868
}
869+
866870
void push(State state)
867871
{
868-
debug << "PUSH: " << state << std::endl;
872+
debug.str("");
873+
debug << state;
869874
states.push_back(state);
875+
O2_SIGNPOST_START(workflow_importer, _o2_signpost_id_t{(int64_t)states.size()}, "import", "PUSH: %s", debug.str().c_str());
870876
}
871877

872878
State pop()
@@ -877,11 +883,12 @@ struct WorkflowImporter : public rapidjson::BaseReaderHandler<rapidjson::UTF8<>,
877883
}
878884
auto result = states.back();
879885
states.pop_back();
880-
debug << "POP: " << result;
886+
debug.str("");
887+
debug << result;
881888
if (!states.empty()) {
882889
debug << " now in " << states.back();
883890
}
884-
debug << std::endl;
891+
O2_SIGNPOST_END(workflow_importer, _o2_signpost_id_t{(int64_t)states.size()+1}, "import", "POP: %s", debug.str().c_str());
885892
return result;
886893
}
887894
bool in(State o)

0 commit comments

Comments
 (0)