spdk_top: set minimal time on refresh rate
Set minimal required time for data gathering thread to give display thread time to redraw all windows. This is useful when user-defined refresh rate is set to 0. With minimal required time hardcoded here, we avoid multiple data refresh calls during one display refresh (because drawing on screen takes more time). Signed-off-by: Krzysztof Karas <krzysztof.karas@intel.com> Change-Id: I44ae808bc25eed36de60eccce30c8ecdeca5088d Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7396 Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com> Community-CI: Mellanox Build Bot Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com> Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
parent
65da9a26d3
commit
fb558e0dff
@ -2206,7 +2206,9 @@ change_refresh_rate(void)
|
||||
stop_loop = true;
|
||||
break;
|
||||
case 10: /* Enter */
|
||||
pthread_mutex_lock(&g_thread_lock);
|
||||
g_sleep_time = refresh_rate;
|
||||
pthread_mutex_unlock(&g_thread_lock);
|
||||
stop_loop = true;
|
||||
break;
|
||||
}
|
||||
@ -2733,6 +2735,7 @@ static void *
|
||||
data_thread_routine(void *arg)
|
||||
{
|
||||
int rc;
|
||||
uint64_t refresh_rate;
|
||||
|
||||
while (1) {
|
||||
pthread_mutex_lock(&g_thread_lock);
|
||||
@ -2740,6 +2743,13 @@ data_thread_routine(void *arg)
|
||||
pthread_mutex_unlock(&g_thread_lock);
|
||||
break;
|
||||
}
|
||||
|
||||
if (g_sleep_time == 0) {
|
||||
/* Give display thread time to redraw all windows */
|
||||
refresh_rate = SPDK_SEC_TO_USEC / 100;
|
||||
} else {
|
||||
refresh_rate = g_sleep_time * SPDK_SEC_TO_USEC;
|
||||
}
|
||||
pthread_mutex_unlock(&g_thread_lock);
|
||||
|
||||
/* Get data from RPC for each object type.
|
||||
@ -2762,7 +2772,7 @@ data_thread_routine(void *arg)
|
||||
print_bottom_message("ERROR occurred while getting scheduler data");
|
||||
}
|
||||
|
||||
usleep(g_sleep_time * SPDK_SEC_TO_USEC);
|
||||
usleep(refresh_rate);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
|
Loading…
Reference in New Issue
Block a user