56 lines
2.2 KiB
Diff
56 lines
2.2 KiB
Diff
From 67cba751363d35fcf88aae7f82616d560d7403fa Mon Sep 17 00:00:00 2001
|
|
From: "Benjamin A. Beasley" <code@musicinmybrain.net>
|
|
Date: Tue, 14 Sep 2021 15:00:41 -0400
|
|
Subject: [PATCH] Adapt to google-benchmark 1.6.0
|
|
|
|
State::thread_index and State::threads are now accessor methods instead
|
|
of data members.
|
|
---
|
|
test/cpp/microbenchmarks/bm_cq_multiple_threads.cc | 2 +-
|
|
test/cpp/microbenchmarks/bm_threadpool.cc | 6 +++---
|
|
2 files changed, 4 insertions(+), 4 deletions(-)
|
|
|
|
diff --git a/test/cpp/microbenchmarks/bm_cq_multiple_threads.cc b/test/cpp/microbenchmarks/bm_cq_multiple_threads.cc
|
|
index d57a021cee..f9cdd67809 100644
|
|
--- a/test/cpp/microbenchmarks/bm_cq_multiple_threads.cc
|
|
+++ b/test/cpp/microbenchmarks/bm_cq_multiple_threads.cc
|
|
@@ -160,7 +160,7 @@ static void teardown() {
|
|
*/
|
|
static void BM_Cq_Throughput(benchmark::State& state) {
|
|
gpr_timespec deadline = gpr_inf_future(GPR_CLOCK_MONOTONIC);
|
|
- auto thd_idx = state.thread_index;
|
|
+ auto thd_idx = state.thread_index();
|
|
|
|
gpr_mu_lock(&g_mu);
|
|
g_threads_active++;
|
|
diff --git a/test/cpp/microbenchmarks/bm_threadpool.cc b/test/cpp/microbenchmarks/bm_threadpool.cc
|
|
index b06deeeb37..cedad52ed2 100644
|
|
--- a/test/cpp/microbenchmarks/bm_threadpool.cc
|
|
+++ b/test/cpp/microbenchmarks/bm_threadpool.cc
|
|
@@ -152,11 +152,11 @@ class SuicideFunctorForAdd : public grpc_completion_queue_functor {
|
|
static void BM_ThreadPoolExternalAdd(benchmark::State& state) {
|
|
static grpc_core::ThreadPool* external_add_pool = nullptr;
|
|
// Setup for each run of test.
|
|
- if (state.thread_index == 0) {
|
|
+ if (state.thread_index() == 0) {
|
|
const int num_threads = state.range(1);
|
|
external_add_pool = new grpc_core::ThreadPool(num_threads);
|
|
}
|
|
- const int num_iterations = state.range(0) / state.threads;
|
|
+ const int num_iterations = state.range(0) / state.threads();
|
|
while (state.KeepRunningBatch(num_iterations)) {
|
|
BlockingCounter counter(num_iterations);
|
|
for (int i = 0; i < num_iterations; ++i) {
|
|
@@ -166,7 +166,7 @@ static void BM_ThreadPoolExternalAdd(benchmark::State& state) {
|
|
}
|
|
|
|
// Teardown at the end of each test run.
|
|
- if (state.thread_index == 0) {
|
|
+ if (state.thread_index() == 0) {
|
|
state.SetItemsProcessed(state.range(0));
|
|
delete external_add_pool;
|
|
}
|
|
--
|
|
2.31.1
|
|
|