lib/thread: Add busy count for poller to increment only when some work was done
Currently run count of poller has been incremented per execution. It will be helpful for us to know how poller is busy by adding busy count which is incremented only when some work is done. spdk_thread_poll() has used the same timestamp in it, and so this is the maximum we can do for now. Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com> Change-Id: I0adfbf9a62c959499978124ecc97d377c96c3769 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/1713 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com> Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
parent
b32411ddaa
commit
99e4374f8d
@ -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
|
||||
}
|
||||
],
|
||||
|
@ -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;
|
||||
|
@ -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) {
|
||||
|
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user