thread: Passing NULL to spdk_thread_get_last_tsc gets current thread

value

If the user passes NULL for the thread, just use the current thread
to get the last tsc.

Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Change-Id: I1a2b61d9765e1ef59927ffec7c49f2a2b62590f6
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/4320
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
Ben Walker 2020-09-18 11:36:00 -07:00 committed by Tomasz Zawadzki
parent 7deedab66a
commit c99e1d60d3

View File

@ -822,6 +822,10 @@ spdk_thread_get_stats(struct spdk_thread_stats *stats)
uint64_t uint64_t
spdk_thread_get_last_tsc(struct spdk_thread *thread) spdk_thread_get_last_tsc(struct spdk_thread *thread)
{ {
if (thread == NULL) {
thread = _get_thread();
}
return thread->tsc_last; return thread->tsc_last;
} }