thread: Add poller run times counter
This will be used by upcoming spdk_top application. Signed-off-by: Maciej Szwed <maciej.szwed@intel.com> Change-Id: I9ffcc3f2e36b8044bbc394938fc7a1dca1dc6892 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/1211 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com> Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
This commit is contained in:
parent
7f6eeaac7d
commit
fe5a044c93
@ -653,6 +653,7 @@ Example response:
|
|||||||
{
|
{
|
||||||
"name": "spdk_rpc_subsystem_poll",
|
"name": "spdk_rpc_subsystem_poll",
|
||||||
"state": "waiting",
|
"state": "waiting",
|
||||||
|
"run_count": 12345
|
||||||
"period_ticks": 10000000
|
"period_ticks": 10000000
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
@ -69,6 +69,7 @@ struct spdk_poller {
|
|||||||
|
|
||||||
uint64_t period_ticks;
|
uint64_t period_ticks;
|
||||||
uint64_t next_run_tick;
|
uint64_t next_run_tick;
|
||||||
|
uint64_t run_count;
|
||||||
spdk_poller_fn fn;
|
spdk_poller_fn fn;
|
||||||
void *arg;
|
void *arg;
|
||||||
struct spdk_thread *thread;
|
struct spdk_thread *thread;
|
||||||
|
@ -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->state = SPDK_POLLER_STATE_RUNNING;
|
||||||
poller_rc = poller->fn(poller->arg);
|
poller_rc = poller->fn(poller->arg);
|
||||||
|
|
||||||
|
poller->run_count++;
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
if (poller_rc == -1) {
|
if (poller_rc == -1) {
|
||||||
SPDK_DEBUGLOG(SPDK_LOG_THREAD, "Poller %s returned -1\n", poller->name);
|
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;
|
poller->state = SPDK_POLLER_STATE_RUNNING;
|
||||||
timer_rc = poller->fn(poller->arg);
|
timer_rc = poller->fn(poller->arg);
|
||||||
|
|
||||||
|
poller->run_count++;
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
if (timer_rc == -1) {
|
if (timer_rc == -1) {
|
||||||
SPDK_DEBUGLOG(SPDK_LOG_THREAD, "Timed poller %s returned -1\n", poller->name);
|
SPDK_DEBUGLOG(SPDK_LOG_THREAD, "Timed poller %s returned -1\n", poller->name);
|
||||||
|
@ -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_object_begin(w);
|
||||||
spdk_json_write_named_string(w, "name", poller->name);
|
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_string(w, "state", spdk_poller_state_str(poller->state));
|
||||||
|
spdk_json_write_named_uint64(w, "run_count", poller->run_count);
|
||||||
if (poller->period_ticks) {
|
if (poller->period_ticks) {
|
||||||
spdk_json_write_named_uint64(w, "period_ticks", poller->period_ticks);
|
spdk_json_write_named_uint64(w, "period_ticks", poller->period_ticks);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user