aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/cpp/qps
diff options
context:
space:
mode:
authorGravatar Craig Tiller <ctiller@google.com>2017-08-31 15:52:57 -0700
committerGravatar Craig Tiller <ctiller@google.com>2017-08-31 15:52:57 -0700
commit289723560948e8ec422e659febc73a766845f9ed (patch)
tree9098f99faa9596d739ea0b8cd1e752a6317f25d3 /test/cpp/qps
parent890f542498a8af4c05f22e42d818f3b0eeafaea8 (diff)
Expose stats into qps_driver
Diffstat (limited to 'test/cpp/qps')
-rw-r--r--test/cpp/qps/client.h5
-rw-r--r--test/cpp/qps/report.cc28
-rw-r--r--test/cpp/qps/report.h3
-rw-r--r--test/cpp/qps/server.h5
4 files changed, 41 insertions, 0 deletions
diff --git a/test/cpp/qps/client.h b/test/cpp/qps/client.h
index b1d90aa9c4..7fbaf63492 100644
--- a/test/cpp/qps/client.h
+++ b/test/cpp/qps/client.h
@@ -34,6 +34,7 @@
#include "src/proto/grpc/testing/payloads.pb.h"
#include "src/proto/grpc/testing/services.grpc.pb.h"
+#include "src/cpp/util/core_stats.h"
#include "test/cpp/qps/histogram.h"
#include "test/cpp/qps/interarrival.h"
#include "test/cpp/qps/usage_timer.h"
@@ -172,6 +173,9 @@ class Client {
timer_result = timer_->Mark();
}
+ grpc_stats_data core_stats;
+ grpc_stats_collect(&core_stats);
+
ClientStats stats;
latencies.FillProto(stats.mutable_latencies());
for (StatusHistogram::const_iterator it = statuses.begin();
@@ -184,6 +188,7 @@ class Client {
stats.set_time_system(timer_result.system);
stats.set_time_user(timer_result.user);
stats.set_cq_poll_count(poll_count);
+ CoreStatsToProto(core_stats, stats.mutable_core_stats());
return stats;
}
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 <grpc++/client_context.h>
+#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) {
diff --git a/test/cpp/qps/report.h b/test/cpp/qps/report.h
index 321be2a97f..1d7b2b54e7 100644
--- a/test/cpp/qps/report.h
+++ b/test/cpp/qps/report.h
@@ -104,6 +104,9 @@ class GprLogReporter : public Reporter {
void ReportCpuUsage(const ScenarioResult& result) override;
void ReportPollCount(const ScenarioResult& result) override;
void ReportQueriesPerCpuSec(const ScenarioResult& result) override;
+
+ void ReportCoreStats(const char* name, int idx,
+ const grpc::core::Stats& stats);
};
/** Dumps the report to a JSON file. */
diff --git a/test/cpp/qps/server.h b/test/cpp/qps/server.h
index 3d6f347cae..16d101d5e6 100644
--- a/test/cpp/qps/server.h
+++ b/test/cpp/qps/server.h
@@ -26,6 +26,7 @@
#include <grpc/support/log.h>
#include <vector>
+#include "src/cpp/util/core_stats.h"
#include "src/proto/grpc/testing/control.pb.h"
#include "src/proto/grpc/testing/messages.pb.h"
#include "test/core/end2end/data/ssl_test_data.h"
@@ -63,6 +64,9 @@ class Server {
timer_result = timer_->Mark();
}
+ grpc_stats_data core_stats;
+ grpc_stats_collect(&core_stats);
+
ServerStats stats;
stats.set_time_elapsed(timer_result.wall);
stats.set_time_system(timer_result.system);
@@ -70,6 +74,7 @@ class Server {
stats.set_total_cpu_time(timer_result.total_cpu_time);
stats.set_idle_cpu_time(timer_result.idle_cpu_time);
stats.set_cq_poll_count(poll_count);
+ CoreStatsToProto(core_stats, stats.mutable_core_stats());
return stats;
}