diff options
Diffstat (limited to 'test/cpp/qps/report.cc')
-rw-r--r-- | test/cpp/qps/report.cc | 74 |
1 files changed, 69 insertions, 5 deletions
diff --git a/test/cpp/qps/report.cc b/test/cpp/qps/report.cc index 94aacdbd1c..ff01ec1501 100644 --- a/test/cpp/qps/report.cc +++ b/test/cpp/qps/report.cc @@ -67,7 +67,6 @@ void CompositeReporter::ReportTimes(const ScenarioResult& result) { } } - void GprLogReporter::ReportQPS(const ScenarioResult& result) { gpr_log(GPR_INFO, "QPS: %.1f", result.latencies.Count() / @@ -76,10 +75,9 @@ void GprLogReporter::ReportQPS(const ScenarioResult& result) { } void GprLogReporter::ReportQPSPerCore(const ScenarioResult& result) { - auto qps = - result.latencies.Count() / - average(result.client_resources, - [](ResourceUsage u) { return u.wall_time; }); + auto qps = result.latencies.Count() / + average(result.client_resources, + [](ResourceUsage u) { return u.wall_time; }); gpr_log(GPR_INFO, "QPS: %.1f (%.1f/server core)", qps, qps / result.server_config.threads()); @@ -118,5 +116,71 @@ void GprLogReporter::ReportTimes(const ScenarioResult& result) { [](ResourceUsage u) { return u.wall_time; })); } +void PerfDbReporter::ReportQPS(const ScenarioResult& result) { + auto qps = result.latencies.Count() / + average(result.client_resources, + [](ResourceUsage u) { return u.wall_time; }); + + perf_db_client_.setQps(qps); + perf_db_client_.setConfigs(result.client_config, result.server_config); +} + +void PerfDbReporter::ReportQPSPerCore(const ScenarioResult& result) { + auto qps = result.latencies.Count() / + average(result.client_resources, + [](ResourceUsage u) { return u.wall_time; }); + + auto qpsPerCore = qps / result.server_config.threads(); + + perf_db_client_.setQps(qps); + perf_db_client_.setQpsPerCore(qpsPerCore); + perf_db_client_.setConfigs(result.client_config, result.server_config); +} + +void PerfDbReporter::ReportLatency(const ScenarioResult& result) { + perf_db_client_.setLatencies(result.latencies.Percentile(50) / 1000, + result.latencies.Percentile(90) / 1000, + result.latencies.Percentile(95) / 1000, + result.latencies.Percentile(99) / 1000, + result.latencies.Percentile(99.9) / 1000); + perf_db_client_.setConfigs(result.client_config, result.server_config); +} + +void PerfDbReporter::ReportTimes(const ScenarioResult& result) { + double server_system_time = + 100.0 * sum(result.server_resources, + [](ResourceUsage u) { return u.system_time; }) / + sum(result.server_resources, [](ResourceUsage u) { return u.wall_time; }); + double server_user_time = + 100.0 * sum(result.server_resources, + [](ResourceUsage u) { return u.user_time; }) / + sum(result.server_resources, [](ResourceUsage u) { return u.wall_time; }); + double client_system_time = + 100.0 * sum(result.client_resources, + [](ResourceUsage u) { return u.system_time; }) / + sum(result.client_resources, [](ResourceUsage u) { return u.wall_time; }); + double client_user_time = + 100.0 * sum(result.client_resources, + [](ResourceUsage u) { return u.user_time; }) / + sum(result.client_resources, [](ResourceUsage u) { return u.wall_time; }); + + perf_db_client_.setTimes(server_system_time, server_user_time, client_system_time, + client_user_time); + perf_db_client_.setConfigs(result.client_config, result.server_config); +} + +void PerfDbReporter::SendData() { + // send data to performance database + bool data_state = + perf_db_client_.sendData(hashed_id_, test_name_, sys_info_, tag_); + + // check state of data sending + if (data_state) { + gpr_log(GPR_INFO, "Data sent to performance database successfully"); + } else { + gpr_log(GPR_INFO, "Data could not be sent to performance database"); + } +} + } // namespace testing } // namespace grpc |