From c99e1d60d314577aeaa0ba36adefc42fea6410ee Mon Sep 17 00:00:00 2001 From: Ben Walker Date: Fri, 18 Sep 2020 11:36:00 -0700 Subject: [PATCH] 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 Change-Id: I1a2b61d9765e1ef59927ffec7c49f2a2b62590f6 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/4320 Reviewed-by: Changpeng Liu Reviewed-by: Aleksey Marchuk Reviewed-by: Jim Harris Tested-by: SPDK CI Jenkins --- lib/thread/thread.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/thread/thread.c b/lib/thread/thread.c index 65d91ce35..f95f167d9 100644 --- a/lib/thread/thread.c +++ b/lib/thread/thread.c @@ -822,6 +822,10 @@ spdk_thread_get_stats(struct spdk_thread_stats *stats) uint64_t spdk_thread_get_last_tsc(struct spdk_thread *thread) { + if (thread == NULL) { + thread = _get_thread(); + } + return thread->tsc_last; }