diff options
author | Craig Tiller <ctiller@google.com> | 2017-09-07 13:13:36 -0700 |
---|---|---|
committer | Craig Tiller <ctiller@google.com> | 2017-09-07 13:13:36 -0700 |
commit | 07d2fa77680aa9060c6655c1978aca8528ca01bd (patch) | |
tree | d31c4fb13cc81d26e870c6bcd774cb16c281ea9e | |
parent | 022ad3ae8906c7ee2440f1c3894ccc73ca14529a (diff) |
Better executor stats
-rw-r--r-- | src/core/lib/debug/stats_data.c | 4 | ||||
-rw-r--r-- | src/core/lib/debug/stats_data.h | 15 | ||||
-rw-r--r-- | src/core/lib/debug/stats_data.yaml | 5 | ||||
-rw-r--r-- | src/core/lib/iomgr/executor.c | 9 |
4 files changed, 26 insertions, 7 deletions
diff --git a/src/core/lib/debug/stats_data.c b/src/core/lib/debug/stats_data.c index f4ac2ddbd2..08b7740cc4 100644 --- a/src/core/lib/debug/stats_data.c +++ b/src/core/lib/debug/stats_data.c @@ -44,10 +44,12 @@ const char *grpc_stats_counter_name[GRPC_STATS_COUNTER_COUNT] = { "combiner_locks_scheduled_items", "combiner_locks_scheduled_final_items", "combiner_locks_offloaded", - "executor_scheduled_items", + "executor_scheduled_short_items", + "executor_scheduled_long_items", "executor_scheduled_to_self", "executor_wakeup_initiated", "executor_queue_drained", + "executor_push_retries", }; const char *grpc_stats_histogram_name[GRPC_STATS_HISTOGRAM_COUNT] = { "tcp_write_size", "tcp_write_iov_size", "tcp_read_size", diff --git a/src/core/lib/debug/stats_data.h b/src/core/lib/debug/stats_data.h index 9b2d43a03c..aa6d81cc7e 100644 --- a/src/core/lib/debug/stats_data.h +++ b/src/core/lib/debug/stats_data.h @@ -46,10 +46,12 @@ typedef enum { GRPC_STATS_COUNTER_COMBINER_LOCKS_SCHEDULED_ITEMS, GRPC_STATS_COUNTER_COMBINER_LOCKS_SCHEDULED_FINAL_ITEMS, GRPC_STATS_COUNTER_COMBINER_LOCKS_OFFLOADED, - GRPC_STATS_COUNTER_EXECUTOR_SCHEDULED_ITEMS, + GRPC_STATS_COUNTER_EXECUTOR_SCHEDULED_SHORT_ITEMS, + GRPC_STATS_COUNTER_EXECUTOR_SCHEDULED_LONG_ITEMS, GRPC_STATS_COUNTER_EXECUTOR_SCHEDULED_TO_SELF, GRPC_STATS_COUNTER_EXECUTOR_WAKEUP_INITIATED, GRPC_STATS_COUNTER_EXECUTOR_QUEUE_DRAINED, + GRPC_STATS_COUNTER_EXECUTOR_PUSH_RETRIES, GRPC_STATS_COUNTER_COUNT } grpc_stats_counters; extern const char *grpc_stats_counter_name[GRPC_STATS_COUNTER_COUNT]; @@ -128,9 +130,12 @@ typedef enum { #define GRPC_STATS_INC_COMBINER_LOCKS_OFFLOADED(exec_ctx) \ GRPC_STATS_INC_COUNTER((exec_ctx), \ GRPC_STATS_COUNTER_COMBINER_LOCKS_OFFLOADED) -#define GRPC_STATS_INC_EXECUTOR_SCHEDULED_ITEMS(exec_ctx) \ - GRPC_STATS_INC_COUNTER((exec_ctx), \ - GRPC_STATS_COUNTER_EXECUTOR_SCHEDULED_ITEMS) +#define GRPC_STATS_INC_EXECUTOR_SCHEDULED_SHORT_ITEMS(exec_ctx) \ + GRPC_STATS_INC_COUNTER((exec_ctx), \ + GRPC_STATS_COUNTER_EXECUTOR_SCHEDULED_SHORT_ITEMS) +#define GRPC_STATS_INC_EXECUTOR_SCHEDULED_LONG_ITEMS(exec_ctx) \ + GRPC_STATS_INC_COUNTER((exec_ctx), \ + GRPC_STATS_COUNTER_EXECUTOR_SCHEDULED_LONG_ITEMS) #define GRPC_STATS_INC_EXECUTOR_SCHEDULED_TO_SELF(exec_ctx) \ GRPC_STATS_INC_COUNTER((exec_ctx), \ GRPC_STATS_COUNTER_EXECUTOR_SCHEDULED_TO_SELF) @@ -139,6 +144,8 @@ typedef enum { GRPC_STATS_COUNTER_EXECUTOR_WAKEUP_INITIATED) #define GRPC_STATS_INC_EXECUTOR_QUEUE_DRAINED(exec_ctx) \ GRPC_STATS_INC_COUNTER((exec_ctx), GRPC_STATS_COUNTER_EXECUTOR_QUEUE_DRAINED) +#define GRPC_STATS_INC_EXECUTOR_PUSH_RETRIES(exec_ctx) \ + GRPC_STATS_INC_COUNTER((exec_ctx), GRPC_STATS_COUNTER_EXECUTOR_PUSH_RETRIES) #define GRPC_STATS_INC_TCP_WRITE_SIZE(exec_ctx, value) \ grpc_stats_inc_tcp_write_size((exec_ctx), (int)(value)) void grpc_stats_inc_tcp_write_size(grpc_exec_ctx *exec_ctx, int x); diff --git a/src/core/lib/debug/stats_data.yaml b/src/core/lib/debug/stats_data.yaml index a0d042a688..f445a4b2bf 100644 --- a/src/core/lib/debug/stats_data.yaml +++ b/src/core/lib/debug/stats_data.yaml @@ -61,7 +61,10 @@ - counter: combiner_locks_scheduled_final_items - counter: combiner_locks_offloaded # executor -- counter: executor_scheduled_items +- counter: executor_scheduled_short_items +- counter: executor_scheduled_long_items - counter: executor_scheduled_to_self - counter: executor_wakeup_initiated - counter: executor_queue_drained +- counter: executor_push_retries + diff --git a/src/core/lib/iomgr/executor.c b/src/core/lib/iomgr/executor.c index 141025b64d..a41c43edfd 100644 --- a/src/core/lib/iomgr/executor.c +++ b/src/core/lib/iomgr/executor.c @@ -185,7 +185,11 @@ static void executor_thread(void *arg) { static void executor_push(grpc_exec_ctx *exec_ctx, grpc_closure *closure, grpc_error *error, bool is_short) { bool retry_push; - GRPC_STATS_INC_EXECUTOR_SCHEDULED_ITEMS(exec_ctx); + if (is_short) { + GRPC_STATS_INC_EXECUTOR_SCHEDULED_SHORT_ITEMS(exec_ctx); + } else { + GRPC_STATS_INC_EXECUTOR_SCHEDULED_LONG_ITEMS(exec_ctx); + } do { retry_push = false; size_t cur_thread_count = (size_t)gpr_atm_no_barrier_load(&g_cur_threads); @@ -260,6 +264,9 @@ static void executor_push(grpc_exec_ctx *exec_ctx, grpc_closure *closure, } gpr_spinlock_unlock(&g_adding_thread_lock); } + if (retry_push) { + GRPC_STATS_INC_EXECUTOR_PUSH_RETRIES(exec_ctx); + } } while (retry_push); } |