From cac43de33f906c32e502d1506de4d931a8967c96 Mon Sep 17 00:00:00 2001 From: Na-Na Pang Date: Mon, 14 Oct 2019 13:49:24 -0700 Subject: [PATCH] clang format --- test/cpp/qps/driver.cc | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/test/cpp/qps/driver.cc b/test/cpp/qps/driver.cc index bd513e78a5d..9a52badbc22 100644 --- a/test/cpp/qps/driver.cc +++ b/test/cpp/qps/driver.cc @@ -144,27 +144,35 @@ static void postprocess_scenario_result(ScenarioResult* result) { result->mutable_summary()->set_latency_99(histogram.Percentile(99)); result->mutable_summary()->set_latency_999(histogram.Percentile(99.9)); - // Calculate qps and cpu load for each client and then aggregate results for all clients + // Calculate qps and cpu load for each client and then aggregate results for + // all clients double qps = 0; double client_system_cpu_load = 0, client_user_cpu_load = 0; double server_system_cpu_load = 0, server_user_cpu_load = 0; - for (size_t i = 0; i < result->client_stats_size(); i++){ + for (size_t i = 0; i < result->client_stats_size(); i++) { auto client_stat = result->client_stats(i); qps += client_stat.latencies().count() / client_stat.time_system(); - client_system_cpu_load += client_stat.time_system() / client_stat.time_elapsed(); - client_user_cpu_load += client_stat.time_user() / client_stat.time_elapsed(); + client_system_cpu_load += + client_stat.time_system() / client_stat.time_elapsed(); + client_user_cpu_load += + client_stat.time_user() / client_stat.time_elapsed(); } - // Calculate cpu load for each server and then aggregate results for all servers - for (size_t i = 0; i < result->server_stats_size(); i++){ + // Calculate cpu load for each server and then aggregate results for all + // servers + for (size_t i = 0; i < result->server_stats_size(); i++) { auto server_stat = result->server_stats(i); - server_system_cpu_load += server_stat.time_system() / server_stat.time_elapsed(); - server_user_cpu_load += server_stat.time_user() / server_stat.time_elapsed(); + server_system_cpu_load += + server_stat.time_system() / server_stat.time_elapsed(); + server_user_cpu_load += + server_stat.time_user() / server_stat.time_elapsed(); } result->mutable_summary()->set_qps(qps); // Populate the percentage of cpu load to result summary. - result->mutable_summary()->set_server_system_time(100 * server_system_cpu_load); + result->mutable_summary()->set_server_system_time(100 * + server_system_cpu_load); result->mutable_summary()->set_server_user_time(100 * server_user_cpu_load); - result->mutable_summary()->set_client_system_time(100* client_system_cpu_load); + result->mutable_summary()->set_client_system_time(100 * + client_system_cpu_load); result->mutable_summary()->set_client_user_time(100 * client_user_cpu_load); // For Non-linux platform, get_cpu_usage() is not implemented. Thus,