From e27d189f2165e904dbb3d61616edf3c643df71f0 Mon Sep 17 00:00:00 2001 From: David Klempner Date: Thu, 19 May 2016 13:50:16 -0700 Subject: Factor out json seriailzation code and move it into parse_json. This is for the same reasons as ParseJson, that is so that we can limit the scope of the proto namespace differences between internal and external. --- test/cpp/qps/report.cc | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) (limited to 'test/cpp/qps/report.cc') diff --git a/test/cpp/qps/report.cc b/test/cpp/qps/report.cc index 3ae41399cf..2ec7d8676c 100644 --- a/test/cpp/qps/report.cc +++ b/test/cpp/qps/report.cc @@ -35,11 +35,9 @@ #include -#include -#include - #include #include "test/cpp/qps/driver.h" +#include "test/cpp/qps/parse_json.h" #include "test/cpp/qps/stats.h" namespace grpc { @@ -104,18 +102,8 @@ void GprLogReporter::ReportTimes(const ScenarioResult& result) { } void JsonReporter::ReportQPS(const ScenarioResult& result) { - std::unique_ptr type_resolver( - google::protobuf::util::NewTypeResolverForDescriptorPool( - "type.googleapis.com", - google::protobuf::DescriptorPool::generated_pool())); - grpc::string binary; - grpc::string json_string; - result.SerializeToString(&binary); - auto status = BinaryToJsonString( - type_resolver.get(), "type.googleapis.com/grpc.testing.ScenarioResult", - binary, &json_string); - GPR_ASSERT(status.ok()); - + grpc::string json_string = + SerializeJson(result, "type.googleapis.com/grpc.testing.ScenarioResult"); std::ofstream output_file(report_file_); output_file << json_string; output_file.close(); -- cgit v1.2.3