Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-12-SP1:GA
procps.31624
procps-ng-3.3.9-bsc1121753-Cpus.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File procps-ng-3.3.9-bsc1121753-Cpus.patch of Package procps.31624
Backport upstream fix to get the first CPU summary correct (bsc#1121753) --- top/top.c +++ top/top.c 2019-01-17 17:00:54.732905606 +0100 @@ -91,6 +91,7 @@ static unsigned Page_size; static unsigned Pg2K_shft = 0; /* SMP, Irix/Solaris mode, Linux 2.5.xx support */ +static CPU_t *Cpu_tics; static int Cpu_faux_tot; static float Cpu_pmax; static const char *Cpu_States_fmts; @@ -2345,10 +2346,10 @@ static void zap_fieldstab (void) { * This guy's modeled on libproc's 'eight_cpu_numbers' function except * we preserve all cpu data in our CPU_t array which is organized * as follows: - * cpus[0] thru cpus[n] == tics for each separate cpu + * Cpu_tics[0] thru Cpu_tics[n] == tics for each separate cpu * cpus[sumSLOT] == tics from the 1st /proc/stat line * [ and beyond sumSLOT == tics for each cpu NUMA node ] */ -static CPU_t *cpus_refresh (CPU_t *cpus) { +static void cpus_refresh (void) { #define sumSLOT ( smp_num_cpus ) #define totSLOT ( 1 + smp_num_cpus + Numa_node_tot) static FILE *fp = NULL; @@ -2366,7 +2367,7 @@ static CPU_t *cpus_refresh (CPU_t *cpus) sav_slot = sumSLOT; zap_fieldstab(); if (fp) { fclose(fp); fp = NULL; } - if (cpus) { free(cpus); cpus = NULL; } + if (Cpu_tics) { free(Cpu_tics); Cpu_tics = NULL; } } /* by opening this file once, we'll avoid the hit on minor page faults @@ -2376,7 +2377,7 @@ static CPU_t *cpus_refresh (CPU_t *cpus) error_exit(fmtmk(N_fmt(FAIL_statopn_fmt), strerror(errno))); /* note: we allocate one more CPU_t via totSLOT than 'cpus' so that a slot can hold tics representing the /proc/stat cpu summary */ - cpus = alloc_c(totSLOT * sizeof(CPU_t)); + Cpu_tics = alloc_c(totSLOT * sizeof(CPU_t)); } rewind(fp); fflush(fp); @@ -2399,7 +2400,7 @@ static CPU_t *cpus_refresh (CPU_t *cpus) #undef buffGRW // remember from last time around - sum_ptr = &cpus[sumSLOT]; + sum_ptr = &Cpu_tics[sumSLOT]; memcpy(&sum_ptr->sav, &sum_ptr->cur, sizeof(CT_t)); // then value the last slot with the cpu summary line if (4 > sscanf(bp, "cpu %Lu %Lu %Lu %Lu %Lu %Lu %Lu %Lu" @@ -2426,7 +2427,7 @@ static CPU_t *cpus_refresh (CPU_t *cpus) // now value each separate cpu's tics... for (i = 0; i < sumSLOT; i++) { - CPU_t *cpu_ptr = &cpus[i]; // avoid gcc subscript bloat + CPU_t *cpu_ptr = &Cpu_tics[i]; // avoid gcc subscript bloat #ifdef PRETEND8CPUS bp = buf; #endif @@ -2437,7 +2438,6 @@ static CPU_t *cpus_refresh (CPU_t *cpus) , &cpu_ptr->cur.u, &cpu_ptr->cur.n, &cpu_ptr->cur.s , &cpu_ptr->cur.i, &cpu_ptr->cur.w, &cpu_ptr->cur.x , &cpu_ptr->cur.y, &cpu_ptr->cur.z)) { - memmove(cpu_ptr, sum_ptr, sizeof(CPU_t)); break; // tolerate cpus taken offline } @@ -2477,8 +2477,6 @@ static CPU_t *cpus_refresh (CPU_t *cpus) } // end: for each cpu Cpu_faux_tot = i; // tolerate cpus taken offline - - return cpus; #undef sumSLOT #undef totSLOT } // end: cpus_refresh @@ -5093,7 +5091,6 @@ static void summary_hlp (CPU_t *cpu, con static void summary_show (void) { #define isROOM(f,n) (CHKw(w, f) && Msg_row + (n) < Screen_rows - 1) #define anyFLG 0xffffff - static CPU_t *smpcpu = NULL; WIN_t *w = Curwin; // avoid gcc bloat with a local copy char tmp[MEDBUFSIZ]; int i; @@ -5116,7 +5113,7 @@ static void summary_show (void) { , Frame_stopped, Frame_zombied)); Msg_row += 1; - smpcpu = cpus_refresh(smpcpu); + cpus_refresh(); #ifndef NUMA_DISABLE if (!Numa_node_tot) goto numa_nope; @@ -5124,11 +5121,11 @@ static void summary_show (void) { if (CHKw(w, View_CPUNOD)) { if (Numa_node_sel < 0) { // display the 1st /proc/stat line, then the nodes (if room) - summary_hlp(&smpcpu[smp_num_cpus], N_txt(WORD_allcpus_txt)); + summary_hlp(&Cpu_tics[smp_num_cpus], N_txt(WORD_allcpus_txt)); Msg_row += 1; // display each cpu node's states for (i = 0; i < Numa_node_tot; i++) { - CPU_t *nod_ptr = &smpcpu[1 + smp_num_cpus + i]; + CPU_t *nod_ptr = &Cpu_tics[1 + smp_num_cpus + i]; if (!isROOM(anyFLG, 1)) break; #ifndef OFF_NUMASKIP if (nod_ptr->id) { @@ -5143,13 +5140,13 @@ static void summary_show (void) { } else { // display the node summary, then the associated cpus (if room) snprintf(tmp, sizeof(tmp), N_fmt(NUMA_nodenam_fmt), Numa_node_sel); - summary_hlp(&smpcpu[1 + smp_num_cpus + Numa_node_sel], tmp); + summary_hlp(&Cpu_tics[1 + smp_num_cpus + Numa_node_sel], tmp); Msg_row += 1; for (i = 0; i < Cpu_faux_tot; i++) { - if (Numa_node_sel == smpcpu[i].node) { + if (Numa_node_sel == Cpu_tics[i].node) { if (!isROOM(anyFLG, 1)) break; - snprintf(tmp, sizeof(tmp), N_fmt(WORD_eachcpu_fmt), smpcpu[i].id); - summary_hlp(&smpcpu[i], tmp); + snprintf(tmp, sizeof(tmp), N_fmt(WORD_eachcpu_fmt), Cpu_tics[i].id); + summary_hlp(&Cpu_tics[i], tmp); Msg_row += 1; } } @@ -5159,14 +5156,14 @@ numa_nope: #endif if (CHKw(w, View_CPUSUM)) { // display just the 1st /proc/stat line - summary_hlp(&smpcpu[Cpu_faux_tot], N_txt(WORD_allcpus_txt)); + summary_hlp(&Cpu_tics[Cpu_faux_tot], N_txt(WORD_allcpus_txt)); Msg_row += 1; } else { // display each cpu's states separately, screen height permitting... for (i = 0; i < Cpu_faux_tot; i++) { - snprintf(tmp, sizeof(tmp), N_fmt(WORD_eachcpu_fmt), smpcpu[i].id); - summary_hlp(&smpcpu[i], tmp); + snprintf(tmp, sizeof(tmp), N_fmt(WORD_eachcpu_fmt), Cpu_tics[i].id); + summary_hlp(&Cpu_tics[i], tmp); Msg_row += 1; if (!isROOM(anyFLG, 1)) break; } @@ -5583,14 +5580,15 @@ static void frame_make (void) { // whoa either first time or thread/task mode change, (re)prime the pump... if (Pseudo_row == PROC_XTRA) { + cpus_refresh(); procs_refresh(); usleep(LIB_USLEEP); putp(Cap_clr_scr); } else putp(Batch ? "\n\n" : Cap_home); - procs_refresh(); sysinfo_refresh(0); + procs_refresh(); Tree_idx = Pseudo_row = Msg_row = scrlins = 0; summary_show();
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor