From: Jim Warner Date: Wed, 22 Sep 2021 05:00:00 +0000 (-0500) Subject: top: overlap some more processing for separate threads X-Git-Tag: v4.0.0~114 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f11f43b4f7118f284f9aec19f6885d163848ffe7;p=procps-ng top: overlap some more processing for separate threads In an effort to improve the performance & decrease the cost of our separate background update threads we will relocate some overhead so that it might be overlapped. Signed-off-by: Jim Warner --- diff --git a/top/top.c b/top/top.c index 50e0a11a..b5bc0656 100644 --- a/top/top.c +++ b/top/top.c @@ -6356,27 +6356,11 @@ static void frame_make (void) { WIN_t *w = Curwin; // avoid gcc bloat with a local copy int i, scrlins; - // check auto-sized width increases from the last iteration... - if (AUTOX_MODE && Autox_found) - widths_resize(); - - // deal with potential signal(s) since the last time around... + /* deal with potential signal(s) since the last time around + plus any input which may change 'tasks_refresh' needs... */ if (Frames_signal) zap_fieldstab(); - // whoa either first time or thread/task mode change, (re)prime the pump... - if (Pseudo_row == PROC_XTRA) { -#ifdef THREADED_TSK - sem_post(&Semaphore_tasks_beg); - sem_wait(&Semaphore_tasks_end); -#else - tasks_refresh(NULL); -#endif - usleep(LIB_USLEEP); - putp(Cap_clr_scr); - } else - putp(Batch ? "\n\n" : Cap_home); - #ifdef THREADED_TSK sem_post(&Semaphore_tasks_beg); #else @@ -6393,6 +6377,23 @@ static void frame_make (void) { memory_refresh(NULL); #endif + // check auto-sized width increases from the last iteration... + if (AUTOX_MODE && Autox_found) + widths_resize(); + + // whoa either first time or thread/task mode change, (re)prime the pump... + if (Pseudo_row == PROC_XTRA) { + usleep(LIB_USLEEP); +#ifdef THREADED_TSK + sem_wait(&Semaphore_tasks_end); + sem_post(&Semaphore_tasks_beg); +#else + tasks_refresh(NULL); +#endif + putp(Cap_clr_scr); + } else + putp(Batch ? "\n\n" : Cap_home); + Tree_idx = Pseudo_row = Msg_row = scrlins = 0; summary_show(); Max_lines = (Screen_rows - Msg_row) - 1;