aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/cpp/qps/qps_driver.cc
diff options
context:
space:
mode:
authorGravatar David Garcia Quintas <dgq@google.com>2015-05-18 22:33:02 -0700
committerGravatar David Garcia Quintas <dgq@google.com>2015-05-20 23:08:29 -0700
commit3cc9ec92d90cf24603ee556da2d8b188428e2615 (patch)
treef2a01749b8d12e10d631a56fed6269a2362c827b /test/cpp/qps/qps_driver.cc
parentcdbdedbf23203c5edae587fb42168eb3e2cdd3f3 (diff)
Removed registry for benchmark reports & introduced benchmark_config.{h,cc} in the spirit of test_config.{h,cc}.
The purpose of benchmark_config is to allow for different behaviors to be decided at compile-time.
Diffstat (limited to 'test/cpp/qps/qps_driver.cc')
-rw-r--r--test/cpp/qps/qps_driver.cc30
1 files changed, 20 insertions, 10 deletions
diff --git a/test/cpp/qps/qps_driver.cc b/test/cpp/qps/qps_driver.cc
index 3aa215b448..b06b88d8a0 100644
--- a/test/cpp/qps/qps_driver.cc
+++ b/test/cpp/qps/qps_driver.cc
@@ -31,6 +31,7 @@
*
*/
+#include <memory>
#include <set>
#include <gflags/gflags.h>
@@ -38,7 +39,7 @@
#include "test/cpp/qps/driver.h"
#include "test/cpp/qps/report.h"
-#include "test/cpp/util/test_config.h"
+#include "test/cpp/util/benchmark_config.h"
DEFINE_int32(num_clients, 1, "Number of client binaries");
DEFINE_int32(num_servers, 1, "Number of server binaries");
@@ -69,17 +70,13 @@ using grpc::testing::ClientType;
using grpc::testing::ServerType;
using grpc::testing::RpcType;
using grpc::testing::ResourceUsage;
-using grpc::testing::ReportersRegistry;
-using grpc::testing::GprLogReporter;
-using grpc::testing::ReportData;
using grpc::testing::ReportType;
-int main(int argc, char** argv) {
- grpc::testing::InitTest(&argc, &argv, true);
-
- ReportersRegistry reporters_registry;
- reporters_registry.Register(new GprLogReporter("LogReporter"));
+namespace grpc {
+namespace testing {
+static void QpsDriver(
+ const std::vector<std::unique_ptr<Reporter> >& reporters) {
RpcType rpc_type;
GPR_ASSERT(RpcType_Parse(FLAGS_rpc_type, &rpc_type));
@@ -118,7 +115,20 @@ int main(int argc, char** argv) {
std::set<ReportType> types;
types.insert(grpc::testing::ReportType::REPORT_ALL);
- reporters_registry.Report({client_config, server_config, result}, types);
+ for (const auto& reporter : reporters) {
+ reporter->Report({client_config, server_config, result}, types);
+ }
+}
+
+} // namespace testing
+} // namespace grpc
+
+int main(int argc, char** argv) {
+ grpc::testing::InitBenchmark(&argc, &argv, true);
+ const auto& reporters = grpc::testing::InitBenchmarkReporters();
+
+ signal(SIGPIPE, SIG_IGN);
+ grpc::testing::QpsDriver(reporters);
return 0;
}