Update the scenario results to include start and end time for a test scenario. (#29034)

This commit add start and end timestamp to the existing scenario results.
pull/28857/head
Wanlin Du 3 years ago committed by GitHub
parent bd5fa8aa57
commit 84edc034aa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 9
      src/proto/grpc/testing/BUILD
  2. 5
      src/proto/grpc/testing/control.proto
  3. 14
      test/cpp/qps/driver.cc

@ -42,12 +42,21 @@ grpc_proto_library(
name = "control_proto",
srcs = ["control.proto"],
has_services = False,
well_known_protos = True,
deps = [
"payloads_proto",
"stats_proto",
],
)
proto_library(
name = "control_proto_descriptors",
srcs = ["control.proto"],
deps = [
"@com_google_protobuf//:timestamp_proto",
],
)
grpc_proto_library(
name = "echo_messages_proto",
srcs = ["echo_messages.proto"],

@ -16,6 +16,7 @@ syntax = "proto3";
import "src/proto/grpc/testing/payloads.proto";
import "src/proto/grpc/testing/stats.proto";
import "google/protobuf/timestamp.proto";
package grpc.testing;
@ -265,6 +266,10 @@ message ScenarioResultSummary
// Queries per CPU-sec over all servers or clients
double server_queries_per_cpu_sec = 17;
double client_queries_per_cpu_sec = 18;
// Start and end time for the test scenario
google.protobuf.Timestamp start_time = 19;
google.protobuf.Timestamp end_time =20;
}
// Results of a single benchmark scenario.

@ -18,6 +18,7 @@
#include "test/cpp/qps/driver.h"
#include <chrono>
#include <cinttypes>
#include <deque>
#include <list>
@ -25,6 +26,8 @@
#include <unordered_map>
#include <vector>
#include <google/protobuf/util/time_util.h>
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
#include <grpc/support/string_util.h>
@ -573,6 +576,10 @@ std::unique_ptr<ScenarioResult> RunScenario(
// Start a run
gpr_log(GPR_INFO, "Starting");
google::protobuf::Timestamp start_timestamp =
google::protobuf::util::TimeUtil::GetCurrentTime();
for (size_t i = 0; i < num_servers; i++) {
auto server = &servers[i];
if (!server->stream->Write(server_mark)) {
@ -624,6 +631,9 @@ std::unique_ptr<ScenarioResult> RunScenario(
bool client_finish_first =
(client_config.rpc_type() != STREAMING_FROM_SERVER);
google::protobuf::Timestamp end_timestamp =
google::protobuf::util::TimeUtil::GetCurrentTime();
FinishClients(clients, client_mark);
if (!client_finish_first) {
@ -650,6 +660,10 @@ std::unique_ptr<ScenarioResult> RunScenario(
rrc->set_status_code(it->first);
rrc->set_count(it->second);
}
// Fill in start and end time for the test scenario
result->mutable_summary()->mutable_start_time()->CopyFrom(start_timestamp);
result->mutable_summary()->mutable_end_time()->CopyFrom(end_timestamp);
postprocess_scenario_result(result.get());
return result;
}

Loading…
Cancel
Save