]> granicus.if.org Git - procps-ng/commitdiff
top: overlap some more processing for separate threads
authorJim Warner <james.warner@comcast.net>
Wed, 22 Sep 2021 05:00:00 +0000 (00:00 -0500)
committerCraig Small <csmall@dropbear.xyz>
Sun, 26 Sep 2021 04:47:21 +0000 (14:47 +1000)
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 <james.warner@comcast.net>
top/top.c

index 50e0a11a171190968d728bc33d3b13d327ae0658..b5bc065693fd15d181e214be2f899eb831965c9a 100644 (file)
--- 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;