aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/cpp/qps/qps_json_driver.cc
diff options
context:
space:
mode:
authorGravatar ncteisen <ncteisen@gmail.com>2017-06-14 19:56:29 -0700
committerGravatar ncteisen <ncteisen@gmail.com>2017-06-19 07:36:51 -0700
commit24e820762a9c6b8a5c4179ea39571d0f1a3b5d2c (patch)
tree8d2904b2a6da33372427ca30955f72a2e3265906 /test/cpp/qps/qps_json_driver.cc
parentfb5ad8d2b9b5fc541a3a85703783fe8e7e4ee91b (diff)
Add json out flag to qps driver
Diffstat (limited to 'test/cpp/qps/qps_json_driver.cc')
-rw-r--r--test/cpp/qps/qps_json_driver.cc11
1 files changed, 11 insertions, 0 deletions
diff --git a/test/cpp/qps/qps_json_driver.cc b/test/cpp/qps/qps_json_driver.cc
index a946992100..6fcdaeb974 100644
--- a/test/cpp/qps/qps_json_driver.cc
+++ b/test/cpp/qps/qps_json_driver.cc
@@ -17,6 +17,7 @@
*/
#include <iostream>
+#include <fstream>
#include <memory>
#include <set>
@@ -57,6 +58,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 {
@@ -88,6 +92,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;
}