6909f1
diff -up ./top/top.c.ori ./top/top.c
6909f1
--- ./top/top.c.ori	2017-04-07 18:36:05.953611338 +0200
6909f1
+++ ./top/top.c	2017-04-07 18:37:14.037321741 +0200
6909f1
@@ -91,6 +91,7 @@ static int   Rc_questions;
6909f1
 static unsigned Pg2K_shft = 0;
6909f1
 
6909f1
         /* SMP, Irix/Solaris mode, Linux 2.5.xx support */
6909f1
+static CPU_t      *Cpu_tics;
6909f1
 static int         Cpu_faux_tot;
6909f1
 static float       Cpu_pmax;
6909f1
 static const char *Cpu_States_fmts;
6909f1
@@ -2356,10 +2357,10 @@ static void zap_fieldstab (void) {
6909f1
          * This guy's modeled on libproc's 'eight_cpu_numbers' function except
6909f1
          * we preserve all cpu data in our CPU_t array which is organized
6909f1
          * as follows:
6909f1
-         *    cpus[0] thru cpus[n] == tics for each separate cpu
6909f1
-         *    cpus[sumSLOT]        == tics from the 1st /proc/stat line
6909f1
-         *  [ and beyond sumSLOT   == tics for each cpu NUMA node ] */
6909f1
-static CPU_t *cpus_refresh (CPU_t *cpus) {
6909f1
+         *    Cpu_tics[0] thru Cpu_tics[n] == tics for each separate cpu
6909f1
+         *    Cpu_tics[sumSLOT]            == tics from /proc/stat line #1
6909f1
+         *  [ and beyond sumSLOT           == tics for each cpu NUMA node ] */
6909f1
+static void cpus_refresh (void) {
6909f1
  #define sumSLOT ( smp_num_cpus )
6909f1
  #define totSLOT ( 1 + smp_num_cpus + Numa_node_tot)
6909f1
    static FILE *fp = NULL;
6909f1
@@ -2377,7 +2378,7 @@ static CPU_t *cpus_refresh (CPU_t *cpus)
6909f1
       sav_slot = sumSLOT;
6909f1
       zap_fieldstab();
6909f1
       if (fp) { fclose(fp); fp = NULL; }
6909f1
-      if (cpus) { free(cpus); cpus = NULL; }
6909f1
+      if (Cpu_tics) free(Cpu_tics);
6909f1
    }
6909f1
 
6909f1
    /* by opening this file once, we'll avoid the hit on minor page faults
6909f1
@@ -2387,7 +2388,7 @@ static CPU_t *cpus_refresh (CPU_t *cpus)
6909f1
          error_exit(fmtmk(N_fmt(FAIL_statopn_fmt), strerror(errno)));
6909f1
       /* note: we allocate one more CPU_t via totSLOT than 'cpus' so that a
6909f1
                slot can hold tics representing the /proc/stat cpu summary */
6909f1
-      cpus = alloc_c(totSLOT * sizeof(CPU_t));
6909f1
+      Cpu_tics = alloc_c(totSLOT * sizeof(CPU_t));
6909f1
    }
6909f1
    rewind(fp);
6909f1
    fflush(fp);
6909f1
@@ -2410,7 +2411,7 @@ static CPU_t *cpus_refresh (CPU_t *cpus)
6909f1
  #undef buffGRW
6909f1
 
6909f1
    // remember from last time around
6909f1
-   sum_ptr = &cpus[sumSLOT];
6909f1
+   sum_ptr = &Cpu_tics[sumSLOT];
6909f1
    memcpy(&sum_ptr->sav, &sum_ptr->cur, sizeof(CT_t));
6909f1
    // then value the last slot with the cpu summary line
6909f1
    if (4 > sscanf(bp, "cpu %Lu %Lu %Lu %Lu %Lu %Lu %Lu %Lu"
6909f1
@@ -2437,7 +2438,7 @@ static CPU_t *cpus_refresh (CPU_t *cpus)
6909f1
 
6909f1
    // now value each separate cpu's tics...
6909f1
    for (i = 0; i < sumSLOT; i++) {
6909f1
-      CPU_t *cpu_ptr = &cpus[i];               // avoid gcc subscript bloat
6909f1
+      CPU_t *cpu_ptr = &Cpu_tics[i];           // avoid gcc subscript bloat
6909f1
 #ifdef PRETEND8CPUS
6909f1
       bp = buf;
6909f1
 #endif
6909f1
@@ -2448,7 +2449,6 @@ static CPU_t *cpus_refresh (CPU_t *cpus)
6909f1
          , &cpu_ptr->cur.u, &cpu_ptr->cur.n, &cpu_ptr->cur.s
6909f1
          , &cpu_ptr->cur.i, &cpu_ptr->cur.w, &cpu_ptr->cur.x
6909f1
          , &cpu_ptr->cur.y, &cpu_ptr->cur.z)) {
6909f1
-            memmove(cpu_ptr, sum_ptr, sizeof(CPU_t));
6909f1
             break;        // tolerate cpus taken offline
6909f1
       }
6909f1
 
6909f1
@@ -2488,8 +2488,6 @@ static CPU_t *cpus_refresh (CPU_t *cpus)
6909f1
    } // end: for each cpu
6909f1
 
6909f1
    Cpu_faux_tot = i;      // tolerate cpus taken offline
6909f1
-
6909f1
-   return cpus;
6909f1
  #undef sumSLOT
6909f1
  #undef totSLOT
6909f1
 } // end: cpus_refresh
6909f1
@@ -5119,7 +5117,6 @@ static void summary_hlp (CPU_t *cpu, con
6909f1
 static void summary_show (void) {
6909f1
  #define isROOM(f,n) (CHKw(w, f) && Msg_row + (n) < Screen_rows - 1)
6909f1
  #define anyFLG 0xffffff
6909f1
-   static CPU_t *smpcpu = NULL;
6909f1
    WIN_t *w = Curwin;             // avoid gcc bloat with a local copy
6909f1
    char tmp[MEDBUFSIZ];
6909f1
    int i;
6909f1
@@ -5142,7 +5139,7 @@ static void summary_show (void) {
6909f1
          , Frame_stopped, Frame_zombied));
6909f1
       Msg_row += 1;
6909f1
 
6909f1
-      smpcpu = cpus_refresh(smpcpu);
6909f1
+      cpus_refresh();
6909f1
 
6909f1
 #ifndef NUMA_DISABLE
6909f1
       if (!Numa_node_tot) goto numa_nope;
6909f1
@@ -5150,11 +5147,11 @@ static void summary_show (void) {
6909f1
       if (CHKw(w, View_CPUNOD)) {
6909f1
          if (Numa_node_sel < 0) {
6909f1
             // display the 1st /proc/stat line, then the nodes (if room)
6909f1
-            summary_hlp(&smpcpu[smp_num_cpus], N_txt(WORD_allcpus_txt));
6909f1
+            summary_hlp(&Cpu_tics[smp_num_cpus], N_txt(WORD_allcpus_txt));
6909f1
             Msg_row += 1;
6909f1
             // display each cpu node's states
6909f1
             for (i = 0; i < Numa_node_tot; i++) {
6909f1
-               CPU_t *nod_ptr = &smpcpu[1 + smp_num_cpus + i];
6909f1
+               CPU_t *nod_ptr = &Cpu_tics[1 + smp_num_cpus + i];
6909f1
                if (!isROOM(anyFLG, 1)) break;
6909f1
 #ifndef OFF_NUMASKIP
6909f1
                if (nod_ptr->id) {
6909f1
@@ -5169,13 +5166,13 @@ static void summary_show (void) {
6909f1
          } else {
6909f1
             // display the node summary, then the associated cpus (if room)
6909f1
             snprintf(tmp, sizeof(tmp), N_fmt(NUMA_nodenam_fmt), Numa_node_sel);
6909f1
-            summary_hlp(&smpcpu[1 + smp_num_cpus + Numa_node_sel], tmp);
6909f1
+            summary_hlp(&Cpu_tics[1 + smp_num_cpus + Numa_node_sel], tmp);
6909f1
             Msg_row += 1;
6909f1
             for (i = 0; i < Cpu_faux_tot; i++) {
6909f1
-               if (Numa_node_sel == smpcpu[i].node) {
6909f1
+               if (Numa_node_sel == Cpu_tics[i].node) {
6909f1
                   if (!isROOM(anyFLG, 1)) break;
6909f1
-                  snprintf(tmp, sizeof(tmp), N_fmt(WORD_eachcpu_fmt), smpcpu[i].id);
6909f1
-                  summary_hlp(&smpcpu[i], tmp);
6909f1
+                  snprintf(tmp, sizeof(tmp), N_fmt(WORD_eachcpu_fmt), Cpu_tics[i].id);
6909f1
+                  summary_hlp(&Cpu_tics[i], tmp);
6909f1
                   Msg_row += 1;
6909f1
                }
6909f1
             }
6909f1
@@ -5185,14 +5182,14 @@ numa_nope:
6909f1
 #endif
6909f1
       if (CHKw(w, View_CPUSUM)) {
6909f1
          // display just the 1st /proc/stat line
6909f1
-         summary_hlp(&smpcpu[Cpu_faux_tot], N_txt(WORD_allcpus_txt));
6909f1
+         summary_hlp(&Cpu_tics[Cpu_faux_tot], N_txt(WORD_allcpus_txt));
6909f1
          Msg_row += 1;
6909f1
 
6909f1
       } else {
6909f1
          // display each cpu's states separately, screen height permitting...
6909f1
          for (i = 0; i < Cpu_faux_tot; i++) {
6909f1
-            snprintf(tmp, sizeof(tmp), N_fmt(WORD_eachcpu_fmt), smpcpu[i].id);
6909f1
-            summary_hlp(&smpcpu[i], tmp);
6909f1
+            snprintf(tmp, sizeof(tmp), N_fmt(WORD_eachcpu_fmt), Cpu_tics[i].id);
6909f1
+            summary_hlp(&Cpu_tics[i], tmp);
6909f1
             Msg_row += 1;
6909f1
             if (!isROOM(anyFLG, 1)) break;
6909f1
          }
6909f1
@@ -5643,6 +5640,7 @@ static void frame_make (void) {
6909f1
 
6909f1
    // whoa either first time or thread/task mode change, (re)prime the pump...
6909f1
    if (Pseudo_row == PROC_XTRA) {
6909f1
+      cpus_refresh();
6909f1
       procs_refresh();
6909f1
       usleep(LIB_USLEEP);
6909f1
       putp(Cap_clr_scr);
6909f1
diff -up ./top/top.h.ori ./top/top.h
6909f1
--- ./top/top.h.ori	2017-04-07 18:36:14.921573192 +0200
6909f1
+++ ./top/top.h	2017-04-07 18:37:14.037321741 +0200
6909f1
@@ -728,7 +728,7 @@ typedef struct WIN_t {
6909f1
 //atic inline void   widths_resize (void);
6909f1
 //atic void          zap_fieldstab (void);
6909f1
 /*------  Library Interface  ---------------------------------------------*/
6909f1
-//atic CPU_t        *cpus_refresh (CPU_t *cpus);
6909f1
+//atic void          cpus_refresh (void);
6909f1
 #ifdef OFF_HST_HASH
6909f1
 //atic inline HST_t *hstbsrch (HST_t *hst, int max, int pid);
6909f1
 #else