Commit 99e4374f authored by Shuhei Matsumoto's avatar Shuhei Matsumoto Committed by Tomasz Zawadzki
Browse files

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: default avatarShuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I0adfbf9a62c959499978124ecc97d377c96c3769
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/1713


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarAleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
parent b32411dd
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -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
          }
        ],
+1 −0
Original line number Diff line number Diff line
@@ -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;
+6 −0
Original line number Diff line number Diff line
@@ -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) {
+1 −0
Original line number Diff line number Diff line
@@ -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);
	}