diff --git a/test/cpp/qps/qps_json_driver.cc b/test/cpp/qps/qps_json_driver.cc index f00f771ea02ca42b752e8421f3f07222a5d12dd5..762b2e0485fce00f24a9f4c5a6a198577e865af6 100644 --- a/test/cpp/qps/qps_json_driver.cc +++ b/test/cpp/qps/qps_json_driver.cc @@ -32,6 +32,7 @@ */ #include <iostream> +#include <fstream> #include <memory> #include <set> @@ -72,6 +73,9 @@ DEFINE_string(qps_server_target_override, "", "Override QPS server target to configure in client configs." "Only applicable if there is a single benchmark server."); +DEFINE_string(json_file_out, "", + "File to write the JSON output to."); + namespace grpc { namespace testing { @@ -103,6 +107,13 @@ static std::unique_ptr<ScenarioResult> RunAndReport(const Scenario& scenario, *success = result->server_success(i); } + if (FLAGS_json_file_out != "") { + std::ofstream json_outfile; + json_outfile.open(FLAGS_json_file_out); + json_outfile << "{\"qps\": " << result->summary().qps() << "}\n"; + json_outfile.close(); + } + return result; }