aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/lib/iomgr/timer_manager.cc
diff options
context:
space:
mode:
authorGravatar Muxi Yan <mxyan@google.com>2018-09-26 17:43:14 -0700
committerGravatar Muxi Yan <mxyan@google.com>2018-09-27 10:08:19 -0700
commitd5d881ae9f30dd91c820a97254f56ed36c116454 (patch)
treeccbf4462d7fbfc6aedd230fef33ad7080211c5cc /src/core/lib/iomgr/timer_manager.cc
parente58edaebdc5e12edb6761006a3e150ea9ba9d043 (diff)
Core infrastructure for timer manager debug
Diffstat (limited to 'src/core/lib/iomgr/timer_manager.cc')
-rw-r--r--src/core/lib/iomgr/timer_manager.cc12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/core/lib/iomgr/timer_manager.cc b/src/core/lib/iomgr/timer_manager.cc
index 26de216671..8c9158922d 100644
--- a/src/core/lib/iomgr/timer_manager.cc
+++ b/src/core/lib/iomgr/timer_manager.cc
@@ -61,6 +61,15 @@ static uint64_t g_timed_waiter_generation;
static void timer_thread(void* completed_thread_ptr);
+// For debug only. Forward statistics to another module.
+extern void (*g_grpc_debug_timer_manager_stats)(int64_t timer_manager_init_count, int64_t timer_manager_shutdown_count, int64_t fork_count, int64_t timer_wait_err, int64_t timer_wait_cv);
+// For debug only. Variables storing the counters being logged.
+extern int64_t g_timer_manager_init_count;
+extern int64_t g_timer_manager_shutdown_count;
+extern int64_t g_fork_count;
+extern int64_t g_timer_wait_err;
+extern int64_t g_timer_wait_cv;
+
static void gc_completed_threads(void) {
if (g_completed_threads != nullptr) {
completed_thread* to_gc = g_completed_threads;
@@ -285,6 +294,7 @@ void grpc_timer_manager_init(void) {
gpr_mu_init(&g_mu);
gpr_cv_init(&g_cv_wait);
gpr_cv_init(&g_cv_shutdown);
+ g_timer_manager_init_count++;
g_threaded = false;
g_thread_count = 0;
g_waiter_count = 0;
@@ -319,6 +329,7 @@ static void stop_threads(void) {
}
void grpc_timer_manager_shutdown(void) {
+ g_timer_manager_shutdown_count++;
stop_threads();
gpr_mu_destroy(&g_mu);
@@ -327,6 +338,7 @@ void grpc_timer_manager_shutdown(void) {
}
void grpc_timer_manager_set_threading(bool threaded) {
+ g_fork_count++;
if (threaded) {
start_threads();
} else {