clang-format
diff --git a/test/cpp/qps/client.h b/test/cpp/qps/client.h
index 5cd9995..cdcae9a 100644
--- a/test/cpp/qps/client.h
+++ b/test/cpp/qps/client.h
@@ -71,7 +71,8 @@
explicit Client(const ClientConfig& config)
: 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_.emplace_back(
+ config.server_targets(i % config.server_targets_size()), config);
}
request_.set_response_type(grpc::testing::PayloadType::COMPRESSABLE);
request_.set_response_size(config.payload_size());
@@ -188,8 +189,11 @@
class Thread {
public:
Thread(Client* client, size_t idx)
- : done_(false), new_(nullptr), client_(client), idx_(idx),
- impl_(&Thread::ThreadFunc, this) {}
+ : done_(false),
+ new_(nullptr),
+ client_(client),
+ idx_(idx),
+ impl_(&Thread::ThreadFunc, this) {}
~Thread() {
{
@@ -215,23 +219,23 @@
void ThreadFunc() {
for (;;) {
- // run the loop body
- bool thread_still_ok = client_->ThreadFunc(&histogram_, idx_);
- // lock, see if we're done
- std::lock_guard<std::mutex> g(mu_);
- if (!thread_still_ok) {
- gpr_log(GPR_ERROR, "Finishing client thread due to RPC error");
- done_ = true;
- }
- if (done_) {
- return;
- }
- // check if we're marking, swap out the histogram if so
- if (new_) {
- new_->Swap(&histogram_);
- new_ = nullptr;
- cv_.notify_one();
- }
+ // run the loop body
+ bool thread_still_ok = client_->ThreadFunc(&histogram_, idx_);
+ // lock, see if we're done
+ std::lock_guard<std::mutex> g(mu_);
+ if (!thread_still_ok) {
+ gpr_log(GPR_ERROR, "Finishing client thread due to RPC error");
+ done_ = true;
+ }
+ if (done_) {
+ return;
+ }
+ // check if we're marking, swap out the histogram if so
+ if (new_) {
+ new_->Swap(&histogram_);
+ new_ = nullptr;
+ cv_.notify_one();
+ }
}
}
@@ -242,7 +246,7 @@
bool done_;
Histogram* new_;
Histogram histogram_;
- Client *client_;
+ Client* client_;
size_t idx_;
std::thread impl_;
};
diff --git a/test/cpp/qps/client_async.cc b/test/cpp/qps/client_async.cc
index f517f1a..55f07f7 100644
--- a/test/cpp/qps/client_async.cc
+++ b/test/cpp/qps/client_async.cc
@@ -316,21 +316,25 @@
}
private:
- class boolean { // exists only to avoid data-race on vector<bool>
+ class boolean { // exists only to avoid data-race on vector<bool>
public:
- boolean(): val_(false) {}
- boolean(bool b): val_(b) {}
- operator bool() const {return val_;}
- boolean& operator=(bool b) {val_=b; return *this;}
+ boolean() : val_(false) {}
+ boolean(bool b) : val_(b) {}
+ operator bool() const { return val_; }
+ boolean& operator=(bool b) {
+ val_ = b;
+ return *this;
+ }
+
private:
bool val_;
};
std::vector<std::unique_ptr<CompletionQueue>> cli_cqs_;
std::vector<deadline_list> rpc_deadlines_; // per thread deadlines
- std::vector<int> next_channel_; // per thread round-robin channel ctr
- std::vector<boolean> issue_allowed_; // may this thread attempt to issue
- std::vector<grpc_time> next_issue_; // when should it issue?
+ std::vector<int> next_channel_; // per thread round-robin channel ctr
+ std::vector<boolean> issue_allowed_; // may this thread attempt to issue
+ std::vector<grpc_time> next_issue_; // when should it issue?
std::vector<std::mutex> channel_lock_;
std::vector<context_list> contexts_; // per-channel list of idle contexts
@@ -350,17 +354,15 @@
private:
static void CheckDone(grpc::Status s, SimpleResponse* response) {}
static std::unique_ptr<grpc::ClientAsyncResponseReader<SimpleResponse>>
- StartReq(TestService::Stub* stub, grpc::ClientContext* ctx,
- const SimpleRequest& request, CompletionQueue* cq) {
+ StartReq(TestService::Stub* stub, grpc::ClientContext* ctx,
+ const SimpleRequest& request, CompletionQueue* cq) {
return stub->AsyncUnaryCall(ctx, request, cq);
};
static ClientRpcContext* SetupCtx(int channel_id, TestService::Stub* stub,
const SimpleRequest& req) {
- return new
- ClientRpcContextUnaryImpl<SimpleRequest,
- SimpleResponse>(channel_id, stub, req,
- AsyncUnaryClient::StartReq,
- AsyncUnaryClient::CheckDone);
+ return new ClientRpcContextUnaryImpl<SimpleRequest, SimpleResponse>(
+ channel_id, stub, req, AsyncUnaryClient::StartReq,
+ AsyncUnaryClient::CheckDone);
}
};
@@ -447,19 +449,18 @@
private:
static void CheckDone(grpc::Status s, SimpleResponse* response) {}
- static std::unique_ptr<grpc::ClientAsyncReaderWriter<
- SimpleRequest,SimpleResponse>>
- StartReq(TestService::Stub* stub, grpc::ClientContext* ctx,
- CompletionQueue* cq, void* tag) {
+ static std::unique_ptr<
+ grpc::ClientAsyncReaderWriter<SimpleRequest, SimpleResponse>>
+ StartReq(TestService::Stub* stub, grpc::ClientContext* ctx,
+ CompletionQueue* cq, void* tag) {
auto stream = stub->AsyncStreamingCall(ctx, cq, tag);
return stream;
};
static ClientRpcContext* SetupCtx(int channel_id, TestService::Stub* stub,
const SimpleRequest& req) {
return new ClientRpcContextStreamingImpl<SimpleRequest, SimpleResponse>(
- channel_id, stub, req,
- AsyncStreamingClient::StartReq,
- AsyncStreamingClient::CheckDone);
+ channel_id, stub, req, AsyncStreamingClient::StartReq,
+ AsyncStreamingClient::CheckDone);
}
};
diff --git a/test/cpp/qps/interarrival.h b/test/cpp/qps/interarrival.h
index a4fecb7..da16a15 100644
--- a/test/cpp/qps/interarrival.h
+++ b/test/cpp/qps/interarrival.h
@@ -150,8 +150,8 @@
// rand is the only choice that is portable across POSIX and Windows
// and that supports new and old compilers
double uniform_0_1 = rand() / RAND_MAX;
- random_table_.push_back(std::chrono::nanoseconds(
- static_cast<int64_t>(1e9 * r(uniform_0_1))));
+ random_table_.push_back(
+ std::chrono::nanoseconds(static_cast<int64_t>(1e9 * r(uniform_0_1))));
}
// Now set up the thread positions
for (int i = 0; i < threads; i++) {