aboutsummaryrefslogtreecommitdiffhomepage
path: root/test
diff options
context:
space:
mode:
authorGravatar ncteisen <ncteisen@gmail.com>2017-06-14 19:56:29 -0700
committerGravatar ncteisen <ncteisen@gmail.com>2017-06-26 23:15:51 -0700
commit8f9e01242867b5e2f23224d7efa371dd63840b6e (patch)
tree01d16c3d59174b89fc80ff696c14f10fdc764826 /test
parente726e324e13af3de1381340354115f8292f8e597 (diff)
Add json out flag to qps driver
Diffstat (limited to 'test')
-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 f00f771ea0..762b2e0485 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;
}