Commit 2e2102b0 authored by Krzysztof Karas's avatar Krzysztof Karas Committed by Jim Harris
Browse files

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: default avatarKrzysztof Karas <krzysztof.karas@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8930


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Reviewed-by: default avatarTomasz Zawadzki <tomasz.zawadzki@intel.com>
parent 30d42a84
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -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;