diff --git a/doc/jsonrpc.md b/doc/jsonrpc.md index 019497d8d..f21390a25 100644 --- a/doc/jsonrpc.md +++ b/doc/jsonrpc.md @@ -653,6 +653,7 @@ Example response: { "name": "spdk_rpc_subsystem_poll", "state": "waiting", + "run_count": 12345 "period_ticks": 10000000 } ], diff --git a/include/spdk_internal/thread.h b/include/spdk_internal/thread.h index 0f5da5444..15c445ae1 100644 --- a/include/spdk_internal/thread.h +++ b/include/spdk_internal/thread.h @@ -69,6 +69,7 @@ struct spdk_poller { uint64_t period_ticks; uint64_t next_run_tick; + uint64_t run_count; spdk_poller_fn fn; void *arg; struct spdk_thread *thread; diff --git a/lib/thread/thread.c b/lib/thread/thread.c index b3bc111c1..54bb97b7f 100644 --- a/lib/thread/thread.c +++ b/lib/thread/thread.c @@ -564,6 +564,8 @@ spdk_thread_poll(struct spdk_thread *thread, uint32_t max_msgs, uint64_t now) poller->state = SPDK_POLLER_STATE_RUNNING; poller_rc = poller->fn(poller->arg); + poller->run_count++; + #ifdef DEBUG if (poller_rc == -1) { SPDK_DEBUGLOG(SPDK_LOG_THREAD, "Poller %s returned -1\n", poller->name); @@ -603,6 +605,8 @@ spdk_thread_poll(struct spdk_thread *thread, uint32_t max_msgs, uint64_t now) poller->state = SPDK_POLLER_STATE_RUNNING; timer_rc = poller->fn(poller->arg); + poller->run_count++; + #ifdef DEBUG if (timer_rc == -1) { SPDK_DEBUGLOG(SPDK_LOG_THREAD, "Timed poller %s returned -1\n", poller->name); diff --git a/module/event/rpc/app_rpc.c b/module/event/rpc/app_rpc.c index 9e225f982..aeb953385 100644 --- a/module/event/rpc/app_rpc.c +++ b/module/event/rpc/app_rpc.c @@ -232,6 +232,7 @@ rpc_get_poller(struct spdk_poller *poller, struct spdk_json_write_ctx *w) spdk_json_write_object_begin(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); if (poller->period_ticks) { spdk_json_write_named_uint64(w, "period_ticks", poller->period_ticks); }