Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DPL: add file read name metric #5065

Merged
merged 2 commits into from
Dec 14, 2020
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 6 additions & 0 deletions Framework/Core/src/AODReaderHelpers.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,12 @@ AlgorithmSpec AODReaderHelpers::rootFileReaderCallback()
t2t.fill(tr);
if (info.file) {
totalReadCalls += info.file->GetReadCalls() - before;
static std::string currentFileRead = "";
std::string nextFileRead = info.file->GetPath();
if (currentFileRead != nextFileRead) {
currentFileRead = nextFileRead;
monitoring.send(Metric{currentFileRead, "aod-file-read-path"}.addTag(Key::Subsystem, monitoring::tags::Value::DPL));
}
}
monitoring.send(Metric{(double)ps.GetReadCalls(), "aod-tree-read-calls"}.addTag(Key::Subsystem, monitoring::tags::Value::DPL));
delete tr;
Expand Down
32 changes: 32 additions & 0 deletions Framework/Core/src/ResourcesMonitoringHelper.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,38 @@

using namespace o2::framework;

template <typename T>
inline static T retriveValue(T val)
{
return val;
}

inline static std::string retriveValue(const std::reference_wrapper<const StringMetric> val)
{
return std::string(val.get().data);
}

template <typename T>
boost::property_tree::ptree fillNodeWithValue(const DeviceMetricsInfo& deviceMetrics,
const T& metricsStorage, size_t labelIndex, size_t storageIndex)
{

unsigned int loopRange = std::min(deviceMetrics.metrics[labelIndex].filledMetrics, metricsStorage[storageIndex].size());
boost::property_tree::ptree metricNode;

for (unsigned int idx = 0; idx < loopRange; ++idx) {
boost::property_tree::ptree values;
values.add("timestamp", deviceMetrics.timestamps[labelIndex][idx]);
if constexpr (std::is_arithmetic_v<T>) {
values.add("value", std::to_string(retriveValue(std::cref(metricsStorage[storageIndex][idx]))));
} else {
values.add("value", retriveValue(std::cref(metricsStorage[storageIndex][idx])));
}
metricNode.push_back(std::make_pair("", values));
}
return metricNode;
}

bool ResourcesMonitoringHelper::dumpMetricsToJSON(const std::vector<DeviceMetricsInfo>& metrics,
const DeviceMetricsInfo& driverMetrics,
const std::vector<DeviceSpec>& specs,
Expand Down
34 changes: 0 additions & 34 deletions Framework/Core/src/ResourcesMonitoringHelper.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,42 +30,8 @@ struct ResourcesMonitoringHelper {
std::vector<DeviceSpec> const& specs,
std::vector<std::string> const& metricsToDump) noexcept;
static bool isResourcesMonitoringEnabled(unsigned short interval) noexcept { return interval > 0; }

template <typename T>
static boost::property_tree::ptree fillNodeWithValue(const DeviceMetricsInfo& deviceMetrics,
const T& metricsStorage, size_t labelIndex, size_t storageIndex);

template <typename T>
inline static T retriveValue(T val)
{
return val;
}
inline static std::string retriveValue(const std::reference_wrapper<const StringMetric> val)
{
return std::string(val.get().data);
}
};

template <typename T>
boost::property_tree::ptree ResourcesMonitoringHelper::fillNodeWithValue(const DeviceMetricsInfo& deviceMetrics,
const T& metricsStorage, size_t labelIndex, size_t storageIndex)
{

unsigned int loopRange = std::min(deviceMetrics.metrics[labelIndex].filledMetrics, metricsStorage[storageIndex].size());
boost::property_tree::ptree metricNode;

for (unsigned int idx = 0; idx < loopRange; ++idx) {
boost::property_tree::ptree values;
values.add("timestamp", deviceMetrics.timestamps[labelIndex][idx]);
if constexpr (std::is_arithmetic_v<T>) {
values.add("value", std::to_string(retriveValue(std::cref(metricsStorage[storageIndex][idx]))));
} else {
values.add("value", retriveValue(std::cref(metricsStorage[storageIndex][idx])));
}
metricNode.push_back(std::make_pair("", values));
}
return metricNode;
}

} // namespace o2::framework

Expand Down
1 change: 1 addition & 0 deletions Framework/Core/src/runDataProcessing.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -1300,6 +1300,7 @@ int runStateMachine(DataProcessorSpecs const& workflow,
performanceMetrics.push_back("aod-bytes-read-uncompressed");
performanceMetrics.push_back("aod-bytes-read-compressed");
performanceMetrics.push_back("aod-total-read-calls");
performanceMetrics.push_back("aod-file-read-path");
ResourcesMonitoringHelper::dumpMetricsToJSON(metricsInfos, driverInfo.metrics, deviceSpecs, performanceMetrics);
}
// This is a clean exit. Before we do so, if required,
Expand Down