Skip to content
Snippets Groups Projects
Commit 28efff3e authored by Yuxuan Li's avatar Yuxuan Li
Browse files

clang-format

parent 5d3ddeee
No related branches found
No related tags found
No related merge requests found
...@@ -100,10 +100,12 @@ class FullstackFixture : public BaseFixture { ...@@ -100,10 +100,12 @@ class FullstackFixture : public BaseFixture {
} }
} }
void Finish(benchmark::State &state) { void Finish(benchmark::State& state) {
std::ostringstream out; std::ostringstream out;
AddToLabel(out, state); AddToLabel(out, state);
AppendToLabel(out, "polls/iter", (double)grpc_get_cq_poll_num(this->cq()->cq())/state.iterations()); AppendToLabel(
out, "polls/iter",
(double)grpc_get_cq_poll_num(this->cq()->cq()) / state.iterations());
auto label = out.str(); auto label = out.str();
if (label.length() && label[0] == ' ') { if (label.length() && label[0] == ' ') {
label = label.substr(1); label = label.substr(1);
...@@ -223,17 +225,19 @@ class EndpointPairFixture : public BaseFixture { ...@@ -223,17 +225,19 @@ class EndpointPairFixture : public BaseFixture {
} }
} }
void Finish(benchmark::State &state) { void Finish(benchmark::State& state) {
std::ostringstream out; std::ostringstream out;
AddToLabel(out, state); AddToLabel(out, state);
AppendToLabel(out, "polls/iter", (double)grpc_get_cq_poll_num(this->cq()->cq())/state.iterations()); AppendToLabel(
out, "polls/iter",
(double)grpc_get_cq_poll_num(this->cq()->cq()) / state.iterations());
auto label = out.str(); auto label = out.str();
if (label.length() && label[0] == ' ') { if (label.length() && label[0] == ' ') {
label = label.substr(1); label = label.substr(1);
} }
state.SetLabel(label); state.SetLabel(label);
} }
ServerCompletionQueue* cq() { return cq_.get(); } ServerCompletionQueue* cq() { return cq_.get(); }
std::shared_ptr<Channel> channel() { return channel_; } std::shared_ptr<Channel> channel() { return channel_; }
......
...@@ -68,6 +68,7 @@ void TrackCounters::AddToLabel(std::ostream &out, benchmark::State &state) { ...@@ -68,6 +68,7 @@ void TrackCounters::AddToLabel(std::ostream &out, benchmark::State &state) {
#endif #endif
} }
void TrackCounters::AppendToLabel(std::ostream& out, std::string metric, double value) { void TrackCounters::AppendToLabel(std::ostream &out, std::string metric,
double value) {
out << " " << key << ":" << value; out << " " << key << ":" << value;
} }
...@@ -80,7 +80,8 @@ class TrackCounters { ...@@ -80,7 +80,8 @@ class TrackCounters {
public: public:
virtual void Finish(benchmark::State& state); virtual void Finish(benchmark::State& state);
virtual void AddToLabel(std::ostream& out, benchmark::State& state); virtual void AddToLabel(std::ostream& out, benchmark::State& state);
virtual void AppendToLabel(std::ostream& out, std::string metric, double value); virtual void AppendToLabel(std::ostream& out, std::string metric,
double value);
private: private:
#ifdef GPR_LOW_LEVEL_COUNTERS #ifdef GPR_LOW_LEVEL_COUNTERS
......
...@@ -198,7 +198,8 @@ class Client { ...@@ -198,7 +198,8 @@ class Client {
stats.set_time_elapsed(timer_result.wall); stats.set_time_elapsed(timer_result.wall);
stats.set_time_system(timer_result.system); stats.set_time_system(timer_result.system);
stats.set_time_user(timer_result.user); stats.set_time_user(timer_result.user);
gpr_log(GPR_INFO, "*****poll count : %d %d %d", GetPollCount(), last_reset_poll_count_, last_reset_poll_count_to_use); gpr_log(GPR_INFO, "*****poll count : %d %d %d", GetPollCount(),
last_reset_poll_count_, last_reset_poll_count_to_use);
stats.set_cq_poll_count(GetPollCount() - last_reset_poll_count_to_use); stats.set_cq_poll_count(GetPollCount() - last_reset_poll_count_to_use);
return stats; return stats;
......
...@@ -209,16 +209,16 @@ class AsyncClient : public ClientImpl<StubType, RequestType> { ...@@ -209,16 +209,16 @@ class AsyncClient : public ClientImpl<StubType, RequestType> {
} }
} }
int GetPollCount() { int GetPollCount() {
int count = 0; int count = 0;
int i = 0; // int i = 0;
for (auto cq = cli_cqs_.begin(); cq != cli_cqs_.end(); cq++) { for (auto cq = cli_cqs_.begin(); cq != cli_cqs_.end(); cq++) {
int k = (int)grpc_get_cq_poll_num((*cq)->cq()); int k = (int)grpc_get_cq_poll_num((*cq)->cq());
gpr_log(GPR_INFO, "%d: per cq poll:%d", i++, k); // gpr_log(GPR_INFO, "%d: per cq poll:%d", i++, k);
count += k; count += k;
}
return count;
} }
return count;
}
protected: protected:
const int num_async_threads_; const int num_async_threads_;
......
...@@ -182,10 +182,14 @@ static void postprocess_scenario_result(ScenarioResult* result) { ...@@ -182,10 +182,14 @@ static void postprocess_scenario_result(ScenarioResult* result) {
result->mutable_summary()->set_failed_requests_per_second(failures / result->mutable_summary()->set_failed_requests_per_second(failures /
time_estimate); time_estimate);
} }
gpr_log(GPR_INFO, "client poll count : %f", sum(result->client_stats(), CliPollCount)); gpr_log(GPR_INFO, "client poll count : %f",
result->mutable_summary()->set_client_polls_per_request(sum(result->client_stats(), CliPollCount)/histogram.Count()); sum(result->client_stats(), CliPollCount));
gpr_log(GPR_INFO, "server poll count : %f", sum(result->server_stats(), SvrPollCount)); result->mutable_summary()->set_client_polls_per_request(
result->mutable_summary()->set_server_polls_per_request(sum(result->server_stats(), SvrPollCount)/histogram.Count()); sum(result->client_stats(), CliPollCount) / histogram.Count());
gpr_log(GPR_INFO, "server poll count : %f",
sum(result->server_stats(), SvrPollCount));
result->mutable_summary()->set_server_polls_per_request(
sum(result->server_stats(), SvrPollCount) / histogram.Count());
} }
std::unique_ptr<ScenarioResult> RunScenario( std::unique_ptr<ScenarioResult> RunScenario(
......
...@@ -49,7 +49,8 @@ namespace testing { ...@@ -49,7 +49,8 @@ namespace testing {
class Server { class Server {
public: public:
explicit Server(const ServerConfig& config) : timer_(new UsageTimer), last_reset_poll_count_(0) { explicit Server(const ServerConfig& config)
: timer_(new UsageTimer), last_reset_poll_count_(0) {
cores_ = gpr_cpu_num_cores(); cores_ = gpr_cpu_num_cores();
if (config.port()) { if (config.port()) {
port_ = config.port(); port_ = config.port();
......
...@@ -160,14 +160,15 @@ class AsyncQpsServerTest final : public grpc::testing::Server { ...@@ -160,14 +160,15 @@ class AsyncQpsServerTest final : public grpc::testing::Server {
int GetPollCount() { int GetPollCount() {
int count = 0; int count = 0;
int i = 0; // int i = 0;
for (auto cq = srv_cqs_.begin(); cq != srv_cqs_.end(); cq++) { for (auto cq = srv_cqs_.begin(); cq != srv_cqs_.end(); cq++) {
int k = (int)grpc_get_cq_poll_num((*cq)->cq()); int k = (int)grpc_get_cq_poll_num((*cq)->cq());
gpr_log(GPR_INFO, "%d: per cq poll:%d", i++, k); // gpr_log(GPR_INFO, "%d: per cq poll:%d", i++, k);
count += k; count += k;
} }
return count; return count;
} }
private: private:
void ShutdownThreadFunc() { void ShutdownThreadFunc() {
// TODO (vpai): Remove this deadline and allow Shutdown to finish properly // TODO (vpai): Remove this deadline and allow Shutdown to finish properly
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment