From 289723560948e8ec422e659febc73a766845f9ed Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Thu, 31 Aug 2017 15:52:57 -0700 Subject: Expose stats into qps_driver --- test/cpp/qps/report.cc | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'test/cpp/qps/report.cc') diff --git a/test/cpp/qps/report.cc b/test/cpp/qps/report.cc index a45b10bcb8..3c99bda144 100644 --- a/test/cpp/qps/report.cc +++ b/test/cpp/qps/report.cc @@ -26,6 +26,7 @@ #include "test/cpp/qps/stats.h" #include +#include "src/cpp/util/core_stats.h" #include "src/proto/grpc/testing/services.grpc.pb.h" namespace grpc { @@ -85,6 +86,33 @@ void GprLogReporter::ReportQPS(const ScenarioResult& result) { gpr_log(GPR_INFO, "successful requests/second: %.1f", result.summary().successful_requests_per_second()); } + for (int i = 0; i < result.client_stats_size(); i++) { + if (result.client_stats(i).has_core_stats()) { + ReportCoreStats("CLIENT", i, result.client_stats(i).core_stats()); + } + } + for (int i = 0; i < result.server_stats_size(); i++) { + if (result.server_stats(i).has_core_stats()) { + ReportCoreStats("SERVER", i, result.server_stats(i).core_stats()); + } + } +} + +void GprLogReporter::ReportCoreStats(const char* name, int idx, + const grpc::core::Stats& stats) { + grpc_stats_data data; + ProtoToCoreStats(stats, &data); + for (int i = 0; i < GRPC_STATS_COUNTER_COUNT; i++) { + gpr_log(GPR_DEBUG, "%s[%d].%s = %" PRIdPTR, name, idx, + grpc_stats_counter_name[i], data.counters[i]); + } + for (int i = 0; i < GRPC_STATS_HISTOGRAM_COUNT; i++) { + gpr_log(GPR_DEBUG, "%s[%d].%s = %lf/%lf/%lf (50/95/99%%-ile)", name, idx, + grpc_stats_histogram_name[i], + grpc_stats_histo_percentile(&data, (grpc_stats_histograms)i, 50), + grpc_stats_histo_percentile(&data, (grpc_stats_histograms)i, 95), + grpc_stats_histo_percentile(&data, (grpc_stats_histograms)i, 99)); + } } void GprLogReporter::ReportQPSPerCore(const ScenarioResult& result) { -- cgit v1.2.3