Remaining changes needed to get QPS test working on old compilers.
This change contains a lot of ugly changes, such as changing
std::vector to allocation by new, etc.
diff --git a/test/cpp/qps/client.h b/test/cpp/qps/client.h
index c7f206d..c7513ed 100644
--- a/test/cpp/qps/client.h
+++ b/test/cpp/qps/client.h
@@ -69,10 +69,10 @@
class Client {
public:
explicit Client(const ClientConfig& config)
- : timer_(new Timer), interarrival_timer_() {
+ : channels_(config.client_channels()), timer_(new Timer), interarrival_timer_() {
for (int i = 0; i < config.client_channels(); i++) {
- channels_.emplace_back(
- config.server_targets(i % config.server_targets_size()), config);
+ channels_[i].init(config.server_targets(i % config.server_targets_size()),
+ config);
}
request_.set_response_type(grpc::testing::PayloadType::COMPRESSABLE);
request_.set_response_size(config.payload_size());
@@ -81,7 +81,7 @@
ClientStats Mark() {
Histogram latencies;
- std::vector<Histogram> to_merge(threads_.size());
+ Histogram to_merge[threads_.size()]; // avoid std::vector for old compilers
for (size_t i = 0; i < threads_.size(); i++) {
threads_[i]->BeginSwap(&to_merge[i]);
}
@@ -108,12 +108,16 @@
class ClientChannelInfo {
public:
- ClientChannelInfo(const grpc::string& target, const ClientConfig& config)
- : channel_(CreateTestChannel(target, config.enable_ssl())),
- stub_(TestService::NewStub(channel_)) {}
+ ClientChannelInfo() {}
+ ClientChannelInfo(const ClientChannelInfo& i): channel_(), stub_() {
+ GPR_ASSERT(!i.channel_ && !i.stub_);
+ }
+ void init(const grpc::string& target, const ClientConfig& config) {
+ channel_ = CreateTestChannel(target, config.enable_ssl());
+ stub_ = TestService::NewStub(channel_);
+ }
ChannelInterface* get_channel() { return channel_.get(); }
TestService::Stub* get_stub() { return stub_.get(); }
-
private:
std::shared_ptr<ChannelInterface> channel_;
std::unique_ptr<TestService::Stub> stub_;