From bbd7037a5f63ec96027aa33621ddba98e11ba244 Mon Sep 17 00:00:00 2001 From: Krzysztof Karas Date: Mon, 26 Jul 2021 14:52:37 +0200 Subject: [PATCH] spdk_top: change CLOCK_REALTIME to CLOCK_MONOTONIC Changes CLOCK_REALTIME to CLOCK_MONOTONIC in show_stats() to avoid getting time_diff values below 0. Time counters in future patches will be using CLOCK_MONOTONIC as well. Change-Id: I4de834e0ad3266986ae11be95859a7bc64e5fc70 Signed-off-by: Krzysztof Karas Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8930 Tested-by: SPDK CI Jenkins Reviewed-by: Jim Harris Reviewed-by: Tomasz Zawadzki --- app/spdk_top/spdk_top.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/spdk_top/spdk_top.c b/app/spdk_top/spdk_top.c index 2cb804779..296b1fa09 100644 --- a/app/spdk_top/spdk_top.c +++ b/app/spdk_top/spdk_top.c @@ -2731,7 +2731,7 @@ show_stats(pthread_t *data_thread) char current_page_str[CURRENT_PAGE_STR_LEN]; bool force_refresh = true; - clock_gettime(CLOCK_REALTIME, &time_now); + clock_gettime(CLOCK_MONOTONIC, &time_now); time_last = time_now.tv_sec; switch_tab(THREADS_TAB); @@ -2751,7 +2751,7 @@ show_stats(pthread_t *data_thread) resize_interface(active_tab); } - clock_gettime(CLOCK_REALTIME, &time_now); + clock_gettime(CLOCK_MONOTONIC, &time_now); time_dif = time_now.tv_sec - time_last; if (time_dif < 0) { time_dif = g_sleep_time;