|  | @@ -77,13 +77,10 @@ static deque<string> get_hosts(const string& name) {
 | 
	
		
			
				|  |  |    }
 | 
	
		
			
				|  |  |  }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -ScenarioResult RunScenario(const ClientConfig& initial_client_config,
 | 
	
		
			
				|  |  | -                           size_t num_clients,
 | 
	
		
			
				|  |  | -                           const ServerConfig& server_config,
 | 
	
		
			
				|  |  | -                           size_t num_servers,
 | 
	
		
			
				|  |  | -                           int warmup_seconds,
 | 
	
		
			
				|  |  | -                           int benchmark_seconds,
 | 
	
		
			
				|  |  | -                           int spawn_local_worker_count) {
 | 
	
		
			
				|  |  | +std::unique_ptr<ScenarioResult> RunScenario(
 | 
	
		
			
				|  |  | +    const ClientConfig& initial_client_config, size_t num_clients,
 | 
	
		
			
				|  |  | +    const ServerConfig& server_config, size_t num_servers, int warmup_seconds,
 | 
	
		
			
				|  |  | +    int benchmark_seconds, int spawn_local_worker_count) {
 | 
	
		
			
				|  |  |    // ClientContext allocator (all are destroyed at scope exit)
 | 
	
		
			
				|  |  |    list<ClientContext> contexts;
 | 
	
		
			
				|  |  |    auto alloc_context = [&contexts]() {
 | 
	
	
		
			
				|  | @@ -91,6 +88,11 @@ ScenarioResult RunScenario(const ClientConfig& initial_client_config,
 | 
	
		
			
				|  |  |      return &contexts.back();
 | 
	
		
			
				|  |  |    };
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +  // To be added to the result, containing the final configuration used for
 | 
	
		
			
				|  |  | +  // client and config (incluiding host, etc.)
 | 
	
		
			
				|  |  | +  ClientConfig result_client_config;
 | 
	
		
			
				|  |  | +  ServerConfig result_server_config;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |    // Get client, server lists
 | 
	
		
			
				|  |  |    auto workers = get_hosts("QPS_WORKERS");
 | 
	
		
			
				|  |  |    ClientConfig client_config = initial_client_config;
 | 
	
	
		
			
				|  | @@ -139,6 +141,8 @@ ScenarioResult RunScenario(const ClientConfig& initial_client_config,
 | 
	
		
			
				|  |  |      sd.stub = std::move(Worker::NewStub(
 | 
	
		
			
				|  |  |          CreateChannel(workers[i], InsecureCredentials(), ChannelArguments())));
 | 
	
		
			
				|  |  |      ServerArgs args;
 | 
	
		
			
				|  |  | +    result_server_config = server_config;
 | 
	
		
			
				|  |  | +    result_server_config.set_host(workers[i]);
 | 
	
		
			
				|  |  |      *args.mutable_setup() = server_config;
 | 
	
		
			
				|  |  |      sd.stream = std::move(sd.stub->RunServer(alloc_context()));
 | 
	
		
			
				|  |  |      GPR_ASSERT(sd.stream->Write(args));
 | 
	
	
		
			
				|  | @@ -168,6 +172,8 @@ ScenarioResult RunScenario(const ClientConfig& initial_client_config,
 | 
	
		
			
				|  |  |      cd.stub = std::move(Worker::NewStub(CreateChannel(
 | 
	
		
			
				|  |  |          workers[i + num_servers], InsecureCredentials(), ChannelArguments())));
 | 
	
		
			
				|  |  |      ClientArgs args;
 | 
	
		
			
				|  |  | +    result_client_config = client_config;
 | 
	
		
			
				|  |  | +    result_client_config.set_host(workers[i + num_servers]);
 | 
	
		
			
				|  |  |      *args.mutable_setup() = client_config;
 | 
	
		
			
				|  |  |      cd.stream = std::move(cd.stub->RunTest(alloc_context()));
 | 
	
		
			
				|  |  |      GPR_ASSERT(cd.stream->Write(args));
 | 
	
	
		
			
				|  | @@ -208,7 +214,9 @@ ScenarioResult RunScenario(const ClientConfig& initial_client_config,
 | 
	
		
			
				|  |  |    gpr_sleep_until(gpr_time_add(start, gpr_time_from_seconds(benchmark_seconds)));
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |    // Finish a run
 | 
	
		
			
				|  |  | -  ScenarioResult result;
 | 
	
		
			
				|  |  | +  std::unique_ptr<ScenarioResult> result(new ScenarioResult);
 | 
	
		
			
				|  |  | +  result->client_config = result_client_config;
 | 
	
		
			
				|  |  | +  result->server_config = result_server_config;
 | 
	
		
			
				|  |  |    gpr_log(GPR_INFO, "Finishing");
 | 
	
		
			
				|  |  |    for (auto server = servers.begin(); server != servers.end(); server++) {
 | 
	
		
			
				|  |  |      GPR_ASSERT(server->stream->Write(server_mark));
 | 
	
	
		
			
				|  | @@ -219,14 +227,14 @@ ScenarioResult RunScenario(const ClientConfig& initial_client_config,
 | 
	
		
			
				|  |  |    for (auto server = servers.begin(); server != servers.end(); server++) {
 | 
	
		
			
				|  |  |      GPR_ASSERT(server->stream->Read(&server_status));
 | 
	
		
			
				|  |  |      const auto& stats = server_status.stats();
 | 
	
		
			
				|  |  | -    result.server_resources.push_back(ResourceUsage{
 | 
	
		
			
				|  |  | +    result->server_resources.push_back(ResourceUsage{
 | 
	
		
			
				|  |  |          stats.time_elapsed(), stats.time_user(), stats.time_system()});
 | 
	
		
			
				|  |  |    }
 | 
	
		
			
				|  |  |    for (auto client = clients.begin(); client != clients.end(); client++) {
 | 
	
		
			
				|  |  |      GPR_ASSERT(client->stream->Read(&client_status));
 | 
	
		
			
				|  |  |      const auto& stats = client_status.stats();
 | 
	
		
			
				|  |  | -    result.latencies.MergeProto(stats.latencies());
 | 
	
		
			
				|  |  | -    result.client_resources.push_back(ResourceUsage{
 | 
	
		
			
				|  |  | +    result->latencies.MergeProto(stats.latencies());
 | 
	
		
			
				|  |  | +    result->client_resources.push_back(ResourceUsage{
 | 
	
		
			
				|  |  |          stats.time_elapsed(), stats.time_user(), stats.time_system()});
 | 
	
		
			
				|  |  |    }
 | 
	
		
			
				|  |  |  
 |