lib/thread: Factor out updating thread stats from spdk_thread_poll()
Subsequent patches will extend spdk_thread_poll() to update thread stats correctly on multiple SPDK threads per CPU core configuration as an new function spdk_thread_poll_ext(). Thread stats will be updated separately by spdk_thread_poll() and spdk_thread_poll_ext(), but updating thread stats itself is the common operation. Hence as a preparation, factor out updating thread stats operation from spdk_thread_poll() to _spdk_thread_update_stats(). Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com> Change-Id: I93c40eb0363ca34f2150299b09c49f1401583832 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/1242 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Paul Luse <paul.e.luse@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
This commit is contained in:
parent
347e1d39b5
commit
82ef75748a
@ -519,6 +519,19 @@ _spdk_thread_insert_poller(struct spdk_thread *thread, struct spdk_poller *polle
|
||||
}
|
||||
}
|
||||
|
||||
static inline void
|
||||
_spdk_thread_update_stats(struct spdk_thread *thread, uint64_t now, int rc)
|
||||
{
|
||||
if (rc == 0) {
|
||||
/* Poller status idle */
|
||||
thread->stats.idle_tsc += now - thread->tsc_last;
|
||||
} else if (rc > 0) {
|
||||
/* Poller status busy */
|
||||
thread->stats.busy_tsc += now - thread->tsc_last;
|
||||
}
|
||||
thread->tsc_last = now;
|
||||
}
|
||||
|
||||
int
|
||||
spdk_thread_poll(struct spdk_thread *thread, uint32_t max_msgs, uint64_t now)
|
||||
{
|
||||
@ -627,14 +640,7 @@ spdk_thread_poll(struct spdk_thread *thread, uint32_t max_msgs, uint64_t now)
|
||||
}
|
||||
}
|
||||
|
||||
if (rc == 0) {
|
||||
/* Poller status idle */
|
||||
thread->stats.idle_tsc += now - thread->tsc_last;
|
||||
} else if (rc > 0) {
|
||||
/* Poller status busy */
|
||||
thread->stats.busy_tsc += now - thread->tsc_last;
|
||||
}
|
||||
thread->tsc_last = now;
|
||||
_spdk_thread_update_stats(thread, now, rc);
|
||||
|
||||
tls_thread = orig_thread;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user