diff --git a/doc/jsonrpc.md b/doc/jsonrpc.md index e22c33843..6ef0c65c4 100644 --- a/doc/jsonrpc.md +++ b/doc/jsonrpc.md @@ -660,7 +660,8 @@ Example response: { "name": "spdk_rpc_subsystem_poll", "state": "waiting", - "run_count": 12345 + "run_count": 12345, + "busy_count": 10000, "period_ticks": 10000000 } ], diff --git a/include/spdk_internal/thread.h b/include/spdk_internal/thread.h index d517e2c37..54dd9934c 100644 --- a/include/spdk_internal/thread.h +++ b/include/spdk_internal/thread.h @@ -70,6 +70,7 @@ struct spdk_poller { uint64_t period_ticks; uint64_t next_run_tick; uint64_t run_count; + uint64_t busy_count; spdk_poller_fn fn; void *arg; struct spdk_thread *thread; diff --git a/lib/thread/thread.c b/lib/thread/thread.c index 455d01046..41dec3a78 100644 --- a/lib/thread/thread.c +++ b/lib/thread/thread.c @@ -593,6 +593,9 @@ _spdk_thread_poll(struct spdk_thread *thread, uint32_t max_msgs, uint64_t now) poller_rc = poller->fn(poller->arg); poller->run_count++; + if (poller_rc > 0) { + poller->busy_count++; + } #ifdef DEBUG if (poller_rc == -1) { @@ -634,6 +637,9 @@ _spdk_thread_poll(struct spdk_thread *thread, uint32_t max_msgs, uint64_t now) timer_rc = poller->fn(poller->arg); poller->run_count++; + if (timer_rc > 0) { + poller->busy_count++; + } #ifdef DEBUG if (timer_rc == -1) { diff --git a/module/event/rpc/app_rpc.c b/module/event/rpc/app_rpc.c index ae65dff7e..b662d5727 100644 --- a/module/event/rpc/app_rpc.c +++ b/module/event/rpc/app_rpc.c @@ -251,6 +251,7 @@ rpc_get_poller(struct spdk_poller *poller, struct spdk_json_write_ctx *w) spdk_json_write_named_string(w, "name", poller->name); spdk_json_write_named_string(w, "state", spdk_poller_state_str(poller->state)); spdk_json_write_named_uint64(w, "run_count", poller->run_count); + spdk_json_write_named_uint64(w, "busy_count", poller->busy_count); if (poller->period_ticks) { spdk_json_write_named_uint64(w, "period_ticks", poller->period_ticks); }