summaryrefslogtreecommitdiffstats
path: root/src/osd/DynamicPerfStats.h
diff options
context:
space:
mode:
authorMykola Golub <mgolub@suse.com>2018-11-14 08:28:10 +0100
committerMykola Golub <mgolub@suse.com>2018-11-20 12:18:30 +0100
commit10dba8a6d6b9b19cf85e9d1fb11818ed076023a1 (patch)
treee96ce825c79d91c289aae5816bc134c6456d0b95 /src/osd/DynamicPerfStats.h
parentmgr: fix PyFormatter's dump_unsigned (diff)
downloadceph-10dba8a6d6b9b19cf85e9d1fb11818ed076023a1.tar.xz
ceph-10dba8a6d6b9b19cf85e9d1fb11818ed076023a1.zip
osd: fixup to recently added dynamic perf stats
Signed-off-by: Mykola Golub <mgolub@suse.com>
Diffstat (limited to 'src/osd/DynamicPerfStats.h')
-rw-r--r--src/osd/DynamicPerfStats.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/osd/DynamicPerfStats.h b/src/osd/DynamicPerfStats.h
index 45259083736..dddfb69ee87 100644
--- a/src/osd/DynamicPerfStats.h
+++ b/src/osd/DynamicPerfStats.h
@@ -19,6 +19,26 @@ public:
}
}
+ void merge(const DynamicPerfStats &dps) {
+ for (auto &query_it : dps.data) {
+ auto &query = query_it.first;
+ for (auto &key_it : query_it.second) {
+ auto &key = key_it.first;
+ auto counter_it = key_it.second.begin();
+ auto update_counter_fnc =
+ [&counter_it](const PerformanceCounterDescriptor &d,
+ PerformanceCounter *c) {
+ c->first += counter_it->first;
+ c->second += counter_it->second;
+ counter_it++;
+ };
+
+ ceph_assert(key_it.second.size() >= data[query][key].size());
+ query.update_counters(update_counter_fnc, &data[query][key]);
+ }
+ }
+ }
+
void set_queries(const std::list<OSDPerfMetricQuery> &queries) {
std::map<OSDPerfMetricQuery,
std::map<OSDPerfMetricKey, PerformanceCounters>> new_data;