From 50a80470afb0d63c623ae0f52ebfa803dcd37451 Mon Sep 17 00:00:00 2001 From: Yingxin Cheng Date: Thu, 25 May 2023 13:58:46 +0800 Subject: [PATCH] crimson/tools/perf_crimson_msgr: report client reactor utilizations Signed-off-by: Yingxin Cheng --- src/crimson/tools/perf_crimson_msgr.cc | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/src/crimson/tools/perf_crimson_msgr.cc b/src/crimson/tools/perf_crimson_msgr.cc index 07979dc2930fa..d6ad00bccb18e 100644 --- a/src/crimson/tools/perf_crimson_msgr.cc +++ b/src/crimson/tools/perf_crimson_msgr.cc @@ -54,6 +54,19 @@ seastar::future create_sharded(Args... args) { }); } +double get_reactor_utilization() { + auto &value_map = seastar::metrics::impl::get_value_map(); + auto found = value_map.find("reactor_utilization"); + assert(found != value_map.end()); + auto &[full_name, metric_family] = *found; + std::ignore = full_name; + assert(metric_family.size() == 1); + const auto& [labels, metric] = *metric_family.begin(); + std::ignore = labels; + auto value = (*metric)(); + return value.ui(); +} + enum class perf_mode_t { both, client, @@ -267,6 +280,7 @@ static seastar::future<> run( mono_time finish_time = mono_clock::zero(); unsigned finish_count = 0u; unsigned depth = 0u; + double reactor_utilization = 0; void start_collect(unsigned received_count) { start_time = mono_clock::now(); @@ -284,6 +298,7 @@ static seastar::future<> run( snapshot.finish_time = mono_clock::now(); snapshot.finish_count = received_count; snapshot.depth = _depth; + snapshot.reactor_utilization = get_reactor_utilization(); start_collect(received_count); } @@ -544,7 +559,11 @@ static seastar::future<> run( << std::setw(6) << depth << std::setw(8) << iops << std::setw(8) << iops * bytes_of_block / 1048576 - << std::setw(8) << (sampled_total_lat_s / sampled_count * 1000); + << std::setw(8) << (sampled_total_lat_s / sampled_count * 1000) + << " -- "; + for (const auto& snap : snaps) { + sout << snap.reactor_utilization << ","; + } std::cout << sout.str() << std::endl; } -- 2.39.5