Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Framework/GUISupport/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ o2_add_library(FrameworkGUISupport
src/PaletteHelpers.cxx
src/SpyService.cxx
src/SpyServiceHelpers.cxx
src/InspectorHelpers.cxx
PRIVATE_INCLUDE_DIRECTORIES ${CMAKE_CURRENT_LIST_DIR}/src
PUBLIC_LINK_LIBRARIES O2::Framework AliceO2::DebugGUI)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ void displayDataRelayer(DeviceMetricsInfo const& /*metrics*/,
continue;
}
if (i == (size_t)row) {
ImGui::Text("%d %.*s (%s)", row, int(end - input), input, InspectorHelpers::getLifeTimeStr(spec.inputs[i].matcher.lifetime).c_str());
ImGui::Text("%d %.*s (%s)", row, int(end - input), input, InspectorHelpers::getLifeTimeStr(spec.inputs[i].matcher.lifetime));
break;
}
++i;
Expand Down
18 changes: 6 additions & 12 deletions Framework/GUISupport/src/FrameworkGUIDeviceInspector.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,8 @@ void deviceStateTable(DataProcessingStates const& states)
}
}

void deviceInfoTable(char const* label, ProcessingStateId id, DataProcessingStates const& states, std::variant<std::vector<InputRoute>, std::vector<OutputRoute>> routes, DeviceMetricsInfo const& metrics)
template <typename Routes>
void deviceInfoTable(char const* label, ProcessingStateId id, DataProcessingStates const& states, Routes const& routes, DeviceMetricsInfo const& metrics)
{
// Find the state spec associated to data_queries
auto& view = states.statesViews[(int)id];
Expand All @@ -95,17 +96,10 @@ void deviceInfoTable(char const* label, ProcessingStateId id, DataProcessingStat
if ((end - input) == 0) {
continue;
}
auto getLifetime = [&routes, &i]() -> Lifetime {
if (std::get_if<std::vector<InputRoute>>(&routes)) {
return std::get<std::vector<InputRoute>>(routes)[i].matcher.lifetime;
} else {
return std::get<std::vector<OutputRoute>>(routes)[i].matcher.lifetime;
}
};
ImGui::Text("%zu: %.*s (%s)", i, int(end - input), input, InspectorHelpers::getLifeTimeStr(getLifetime()).c_str());
ImGui::Text("%zu: %.*s (%s)", i, int(end - input), input, InspectorHelpers::getLifeTimeStr(routes[i].matcher.lifetime));
if (ImGui::IsItemHovered()) {
ImGui::BeginTooltip();
ImGui::Text("%zu: %.*s (%s)", i, int(end - input), input, InspectorHelpers::getLifeTimeStr(getLifetime()).c_str());
ImGui::Text("%zu: %.*s (%s)", i, int(end - input), input, InspectorHelpers::getLifeTimeStr(routes[i].matcher.lifetime));
ImGui::EndTooltip();
}
input = end + 1;
Expand Down Expand Up @@ -346,8 +340,8 @@ void displayDeviceInspector(DeviceSpec const& spec,
}

deviceStateTable(states);
deviceInfoTable("Inputs:", ProcessingStateId::DATA_QUERIES, states, std::variant<std::vector<InputRoute>, std::vector<OutputRoute>>(spec.inputs), metrics);
deviceInfoTable("Outputs:", ProcessingStateId::OUTPUT_MATCHERS, states, std::variant<std::vector<InputRoute>, std::vector<OutputRoute>>(spec.outputs), metrics);
deviceInfoTable("Inputs:", ProcessingStateId::DATA_QUERIES, states, spec.inputs, metrics);
deviceInfoTable("Outputs:", ProcessingStateId::OUTPUT_MATCHERS, states, spec.outputs, metrics);
configurationTable(info.currentConfig, info.currentProvenance);
optionsTable("Workflow Options", metadata.workflowOptions, control);
if (ImGui::CollapsingHeader("Labels", ImGuiTreeNodeFlags_DefaultOpen)) {
Expand Down
40 changes: 40 additions & 0 deletions Framework/GUISupport/src/InspectorHelpers.cxx
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
// Copyright 2019-2025 CERN and copyright holders of ALICE O2.
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
// All rights not expressly granted are reserved.
//
// This software is distributed under the terms of the GNU General Public
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
//
// In applying this license CERN does not waive the privileges and immunities
// granted to it by virtue of its status as an Intergovernmental Organization
// or submit itself to any jurisdiction.

#include "InspectorHelpers.h"

namespace o2::framework
{
char const* InspectorHelpers::getLifeTimeStr(Lifetime lifetime)
{
switch (lifetime) {
case Lifetime::Timeframe:
return "Timeframe";
case Lifetime::Condition:
return "Condition";
case Lifetime::Sporadic:
return "Sporadic";
case Lifetime::Transient:
return "Transient";
case Lifetime::Timer:
return "Timer";
case Lifetime::Enumeration:
return "Enumeration";
case Lifetime::Signal:
return "Signal";
case Lifetime::Optional:
return "Optional";
case Lifetime::OutOfBand:
return "OutOfBand";
}
return "none";
};
} // namespace o2::framework
29 changes: 2 additions & 27 deletions Framework/GUISupport/src/InspectorHelpers.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
// Copyright 2019-2025 CERN and copyright holders of ALICE O2.
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
// All rights not expressly granted are reserved.
//
Expand All @@ -11,39 +11,14 @@
#ifndef O2_FRAMEWORK_INSPECTORHELPERS_H_
#define O2_FRAMEWORK_INSPECTORHELPERS_H_

#include <string>

#include "Framework/Lifetime.h"

namespace o2::framework
{

/// A helper class for inpsection of device information
struct InspectorHelpers {
static const std::string getLifeTimeStr(Lifetime lifetime)
{
switch (lifetime) {
case Lifetime::Timeframe:
return "Timeframe";
case Lifetime::Condition:
return "Condition";
case Lifetime::Sporadic:
return "Sporadic";
case Lifetime::Transient:
return "Transient";
case Lifetime::Timer:
return "Timer";
case Lifetime::Enumeration:
return "Enumeration";
case Lifetime::Signal:
return "Signal";
case Lifetime::Optional:
return "Optional";
case Lifetime::OutOfBand:
return "OutOfBand";
}
return "none";
};
static const char* getLifeTimeStr(Lifetime lifetime);
};

} // namespace o2::framework
Expand Down