Commit fe5a044c authored by Maciej Szwed's avatar Maciej Szwed Committed by Tomasz Zawadzki
Browse files

thread: Add poller run times counter



This will be used by upcoming spdk_top application.

Signed-off-by: default avatarMaciej Szwed <maciej.szwed@intel.com>
Change-Id: I9ffcc3f2e36b8044bbc394938fc7a1dca1dc6892

Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/1211


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
Reviewed-by: default avatarShuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Reviewed-by: default avatarAleksey Marchuk <alexeymar@mellanox.com>
parent 7f6eeaac
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -653,6 +653,7 @@ Example response:
          {
            "name": "spdk_rpc_subsystem_poll",
            "state": "waiting",
            "run_count": 12345
            "period_ticks": 10000000
          }
        ],
+1 −0
Original line number Diff line number Diff line
@@ -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;
+4 −0
Original line number Diff line number Diff line
@@ -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);
+1 −0
Original line number Diff line number Diff line
@@ -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);
	}