Skip to content

Commit e38dfc3

Browse files
authored
DPL GUI: avoid looping over data (#7285)
The maximum number of points to show is given by mod, not by size, which includes the points which were dropped from the ring buffer.
1 parent 443ca91 commit e38dfc3

1 file changed

Lines changed: 12 additions & 6 deletions

File tree

Framework/GUISupport/src/FrameworkGUIDebugger.cxx

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@
3131
#include <string>
3232
#include <cinttypes>
3333

34+
// Make sure we can use aggregated initialisers.
35+
#pragma GCC diagnostic push
36+
#pragma GCC diagnostic ignored "-Wpedantic"
37+
3438
// Simplify debugging
3539
template class std::vector<o2::framework::DeviceMetricsInfo>;
3640

@@ -262,7 +266,7 @@ void displaySparks(
262266
assert(pos >= 0 && pos < 1024);
263267
return ImPlotPoint(histoData->time[pos], ((int*)(histoData->points))[pos]);
264268
};
265-
ImPlot::PlotLineG("##plot", getter, &data, data.size);
269+
ImPlot::PlotLineG("##plot", getter, &data, data.mod);
266270
} break;
267271
case MetricType::Uint64: {
268272
data.points = (void*)metricsInfo.uint64Metrics[metric.storeIdx].data();
@@ -273,7 +277,7 @@ void displaySparks(
273277
assert(pos >= 0 && pos < 1024);
274278
return ImPlotPoint(histoData->time[pos], ((uint64_t*)histoData->points)[pos]);
275279
};
276-
ImPlot::PlotLineG("##plot", getter, &data, data.size, 0);
280+
ImPlot::PlotLineG("##plot", getter, &data, data.mod, 0);
277281
} break;
278282
case MetricType::Float: {
279283
data.points = (void*)metricsInfo.floatMetrics[metric.storeIdx].data();
@@ -284,7 +288,7 @@ void displaySparks(
284288
assert(pos >= 0 && pos < 1024);
285289
return ImPlotPoint(histoData->time[pos], ((float*)histoData->points)[pos]);
286290
};
287-
ImPlot::PlotLineG("##plot", getter, &data, data.size, 0);
291+
ImPlot::PlotLineG("##plot", getter, &data, data.mod, 0);
288292
} break;
289293
default:
290294
return;
@@ -423,7 +427,7 @@ void displayDeviceMetrics(const char* label,
423427
ImGui::PushID(pi);
424428
auto data = (const MultiplotData*)metricsToDisplay[pi];
425429
const char* label = ((MultiplotData*)metricsToDisplay[pi])->legend;
426-
ImPlot::PlotBarsG(label, getterXY, metricsToDisplay[pi], data->size, 1, 0);
430+
ImPlot::PlotBarsG(label, getterXY, metricsToDisplay[pi], data->mod, 1, 0);
427431
ImGui::PopID();
428432
}
429433
ImPlot::EndPlot();
@@ -440,7 +444,7 @@ void displayDeviceMetrics(const char* label,
440444
auto data = (const MultiplotData*)metricsToDisplay[pi];
441445
const char* label = data->legend;
442446
ImPlot::SetPlotYAxis(data->axis);
443-
ImPlot::PlotLineG(data->legend, getterXY, metricsToDisplay[pi], data->size, 0);
447+
ImPlot::PlotLineG(data->legend, getterXY, metricsToDisplay[pi], data->mod, 0);
444448
ImGui::PopID();
445449
}
446450
ImPlot::EndPlot();
@@ -453,7 +457,7 @@ void displayDeviceMetrics(const char* label,
453457
// FIXME: display a message for other metrics
454458
if (data->type == MetricType::Uint64) {
455459
ImGui::PushID(pi);
456-
ImPlot::PlotScatterG(((MultiplotData*)metricsToDisplay[pi])->legend, getterXY, metricsToDisplay[pi], data->size, 0);
460+
ImPlot::PlotScatterG(((MultiplotData*)metricsToDisplay[pi])->legend, getterXY, metricsToDisplay[pi], data->mod, 0);
457461
ImGui::PopID();
458462
}
459463
}
@@ -1111,3 +1115,5 @@ void charIn(char key)
11111115
}
11121116

11131117
} // namespace o2::framework::gui
1118+
1119+
#pragma GCC diagnostic pop

0 commit comments

Comments
 (0)