]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson/tools/perf_crimson_msgr: report client reactor utilizations
authorYingxin Cheng <yingxin.cheng@intel.com>
Thu, 25 May 2023 05:58:46 +0000 (13:58 +0800)
committerMatan Breizman <mbreizma@redhat.com>
Tue, 17 Oct 2023 16:18:41 +0000 (16:18 +0000)
Signed-off-by: Yingxin Cheng <yingxin.cheng@intel.com>
(cherry picked from commit 50a80470afb0d63c623ae0f52ebfa803dcd37451)

src/crimson/tools/perf_crimson_msgr.cc

index 07979dc2930faa87848267a9b0cc0ca7c037aa17..d6ad00bccb18e0aca169fe6545684fd2a8ebdecd 100644 (file)
@@ -54,6 +54,19 @@ seastar::future<T*> 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;
         }