diff options
author | Craig Tiller <ctiller@google.com> | 2017-02-21 10:02:31 -0800 |
---|---|---|
committer | Craig Tiller <ctiller@google.com> | 2017-02-21 10:02:31 -0800 |
commit | f3dec9c995e5c2b85460107a9ad9d937facd9a49 (patch) | |
tree | 4c3b5dec3aea261bc7bf47914db9a967c36938a4 /src | |
parent | 04bd54ac912f92f189a0c884c8ec01255390a17c (diff) |
Add counters for rmw atomic operations to microbenchmarks
Diffstat (limited to 'src')
-rw-r--r-- | src/core/lib/support/sync_posix.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/core/lib/support/sync_posix.c b/src/core/lib/support/sync_posix.c index de0f0484b5..3b7d780608 100644 --- a/src/core/lib/support/sync_posix.c +++ b/src/core/lib/support/sync_posix.c @@ -42,8 +42,9 @@ #include <time.h> #include "src/core/lib/profiling/timers.h" -#ifdef GPR_MU_COUNTERS -gpr_atm grpc_mu_locks = 0; +#ifdef GPR_LOW_LEVEL_COUNTERS +gpr_atm gpr_mu_locks = 0; +gpr_atm gpr_counter_rmw = 0; #endif void gpr_mu_init(gpr_mu* mu) { GPR_ASSERT(pthread_mutex_init(mu, NULL) == 0); } @@ -51,8 +52,8 @@ void gpr_mu_init(gpr_mu* mu) { GPR_ASSERT(pthread_mutex_init(mu, NULL) == 0); } void gpr_mu_destroy(gpr_mu* mu) { GPR_ASSERT(pthread_mutex_destroy(mu) == 0); } void gpr_mu_lock(gpr_mu* mu) { -#ifdef GPR_MU_COUNTERS - gpr_atm_no_barrier_fetch_add(&grpc_mu_locks, 1); +#ifdef GPR_LOW_LEVEL_COUNTERS + GPR_ATM_INC_COUNTER(gpr_mu_locks); #endif GPR_TIMER_BEGIN("gpr_mu_lock", 0); GPR_ASSERT(pthread_mutex_lock(mu) == 0); |