aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Noah Eisen <ncteisen@gmail.com>2017-06-19 09:01:40 -0700
committerGravatar GitHub <noreply@github.com>2017-06-19 09:01:40 -0700
commit716f7afa21b9079099e1e8571b49d21a30c1ed5a (patch)
tree50d9110463969cf356d46091db3c200c6c34881f
parent6f51aa3657120254e7c588ee022e998174e31337 (diff)
parentdc1b51e6b380ecea72622aca9c6677dfab556a13 (diff)
Merge pull request #11505 from ncteisen/qps-driver-json-out
Add JSON Outfile Flag to QPS Driver
-rw-r--r--test/cpp/qps/qps_json_driver.cc10
1 files changed, 10 insertions, 0 deletions
diff --git a/test/cpp/qps/qps_json_driver.cc b/test/cpp/qps/qps_json_driver.cc
index a946992100..590c22ec29 100644
--- a/test/cpp/qps/qps_json_driver.cc
+++ b/test/cpp/qps/qps_json_driver.cc
@@ -16,6 +16,7 @@
*
*/
+#include <fstream>
#include <iostream>
#include <memory>
#include <set>
@@ -57,6 +58,8 @@ 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 +91,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;
}