Skip to content

Commit 9ab80cc

Browse files
committed
DPL GUI: add stems plot
... and use it display SIGUSR1 event.
1 parent 5eb029a commit 9ab80cc

3 files changed

Lines changed: 35 additions & 7 deletions

File tree

Framework/Core/src/AODReaderHelpers.cxx

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@
2828
#include "Framework/ChannelInfo.h"
2929
#include "Framework/Logger.h"
3030

31+
#include <Monitoring/Monitoring.h>
32+
3133
#include <ROOT/RDataFrame.hxx>
3234
#include <TGrid.h>
3335
#include <TFile.h>
@@ -40,6 +42,11 @@
4042

4143
#include <thread>
4244

45+
using o2::monitoring::Metric;
46+
using o2::monitoring::Monitoring;
47+
using o2::monitoring::tags::Key;
48+
using o2::monitoring::tags::Value;
49+
4350
namespace o2::framework::readers
4451
{
4552
auto setEOSCallback(InitContext& ic)
@@ -169,8 +176,10 @@ AlgorithmSpec AODReaderHelpers::rootFileReaderCallback()
169176
auto callback = AlgorithmSpec{adaptStateful([](ConfigParamRegistry const& options,
170177
DeviceSpec const& spec,
171178
Monitoring& monitoring) {
172-
monitoring.send(Metric{0LL, "arrow-bytes-created"}.addTag(Key::Subsystem, Value::DPL));
173-
monitoring.send(Metric{0LL, "arrow-messages-created"}.addTag(Key::Subsystem, Value::DPL));
179+
monitoring.send(Metric{(uint64_t)0, "arrow-bytes-created"}.addTag(Key::Subsystem, monitoring::tags::Value::DPL));
180+
monitoring.send(Metric{(uint64_t)0, "arrow-messages-created"}.addTag(Key::Subsystem, monitoring::tags::Value::DPL));
181+
monitoring.send(Metric{(uint64_t)0, "arrow-bytes-destroyed"}.addTag(Key::Subsystem, monitoring::tags::Value::DPL));
182+
monitoring.send(Metric{(uint64_t)0, "arrow-messages-destroyed"}.addTag(Key::Subsystem, monitoring::tags::Value::DPL));
174183

175184
if (!options.isSet("aod-file")) {
176185
LOGP(ERROR, "No input file defined!");

Framework/Core/src/CommonMessageBackends.cxx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ o2::framework::ServiceSpec CommonMessageBackends::arrowBackendSpec()
157157
static auto totalMessagesCreatedMetric = DeviceMetricsHelper::createNumericMetric<uint64_t>(driverMetrics, "total-arrow-messages-created");
158158
static auto totalMessagesDestroyedMetric = DeviceMetricsHelper::createNumericMetric<uint64_t>(driverMetrics, "total-arrow-messages-destroyed");
159159
static auto totalBytesDeltaMetric = DeviceMetricsHelper::createNumericMetric<int>(driverMetrics, "arrow-bytes-delta");
160-
static auto totalSignalsMetric = DeviceMetricsHelper::createNumericMetric<int>(driverMetrics, "aod-reader-signals");
160+
static auto totalSignalsMetric = DeviceMetricsHelper::createNumericMetric<uint64_t>(driverMetrics, "aod-reader-signals");
161161

162162
bool changed = false;
163163
for (auto& deviceMetrics : allDeviceMetrics) {
@@ -209,6 +209,7 @@ o2::framework::ServiceSpec CommonMessageBackends::arrowBackendSpec()
209209
if (changed) {
210210
/// Trigger next timeframe only when we have more than 1GB in memory available.
211211
if (totalBytesCreated <= (totalBytesDestroyed + memLimit)) {
212+
totalSignalsMetric(driverMetrics, 1, timestamp);
212213
for (size_t di = 0; di < specs.size(); ++di) {
213214
if (specs[di].name == "internal-dpl-aod-reader") {
214215
if (di < infos.size()) {
@@ -263,8 +264,8 @@ o2::framework::ServiceSpec CommonMessageBackends::arrowBackendSpec()
263264
arrow->updateBytesDestroyed(totalBytes);
264265
arrow->updateMessagesDestroyed(totalMessages);
265266
auto& monitoring = ctx.services().get<Monitoring>();
266-
monitoring.send(Metric{(uint64_t)arrow->bytesDestroyed(), "arrow-bytes-destroyed"}.addTag(Key::Subsystem, Value::DPL));
267-
monitoring.send(Metric{(uint64_t)arrow->messagesDestroyed(), "arrow-messages-destroyed"}.addTag(Key::Subsystem, Value::DPL));
267+
monitoring.send(Metric{(uint64_t)arrow->bytesDestroyed(), "arrow-bytes-destroyed"}.addTag(Key::Subsystem, monitoring::tags::Value::DPL));
268+
monitoring.send(Metric{(uint64_t)arrow->messagesDestroyed(), "arrow-messages-destroyed"}.addTag(Key::Subsystem, monitoring::tags::Value::DPL));
268269
monitoring.flushBuffer();
269270
},
270271
ServiceKind::Serial};

Framework/Core/src/FrameworkGUIDebugger.cxx

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,8 @@ enum struct MetricsDisplayStyle : int {
170170
Lines = 0,
171171
Histos = 1,
172172
Sparks = 2,
173-
Table = 3
173+
Table = 3,
174+
Stems = 4
174175
};
175176

176177
void displayDeviceMetrics(const char* label, std::string const& selectedMetricName,
@@ -318,6 +319,21 @@ void displayDeviceMetrics(const char* label, std::string const& selectedMetricNa
318319
ImPlot::EndPlot();
319320
}
320321
break;
322+
case MetricsDisplayStyle::Stems:
323+
ImPlot::SetNextPlotLimitsX(minDomain, maxDomain, ImGuiCond_Once);
324+
ImPlot::SetNextPlotLimitsY(minValue, maxValue * 1.2, ImGuiCond_Always);
325+
ImPlot::SetNextPlotTicksX(minDomain, maxDomain, 5);
326+
if (ImPlot::BeginPlot("##Some plot", "time", "value")) {
327+
for (size_t pi = 0; pi < userData.size(); ++pi) {
328+
auto stemsData = reinterpret_cast<const MultiplotData*>(metricsToDisplay[pi]);
329+
// FIXME: display a message for other metrics
330+
if (stemsData->type == MetricType::Uint64) {
331+
ImPlot::PlotStems(deviceNames[pi], (const ImU64*)stemsData->X, (const ImU64*)stemsData->Y, metricSize);
332+
}
333+
}
334+
ImPlot::EndPlot();
335+
}
336+
break;
321337
default:
322338
break;
323339
}
@@ -522,7 +538,8 @@ void displayDeviceHistograms(gui::WorkspaceGUIState& state,
522538
"lines",
523539
"histograms",
524540
"sparks",
525-
"table"};
541+
"table",
542+
"stems"};
526543
ImGui::SameLine();
527544
static enum MetricsDisplayStyle currentStyle = MetricsDisplayStyle::Lines;
528545
ImGui::Combo("##Select style", reinterpret_cast<int*>(&currentStyle), plotStyles, IM_ARRAYSIZE(plotStyles));
@@ -560,6 +577,7 @@ void displayDeviceHistograms(gui::WorkspaceGUIState& state,
560577
ImGui::EndGroup();
561578
if (!currentMetricName.empty()) {
562579
switch (currentStyle) {
580+
case MetricsDisplayStyle::Stems:
563581
case MetricsDisplayStyle::Histos:
564582
case MetricsDisplayStyle::Lines: {
565583
displayDeviceMetrics("Metrics",

0 commit comments

Comments
 (0)