top: reduce % CPU distortions when a core was turned off
This patch provides for cpu cores which can be turned off completely when idle (Nehalem, etc.) thus registering very few or no tics since the last update cycle. When CPU_ZEROTICS is not defined (the default), any displayed cpu with less than a certain amount of total tics will show as 100% idle. That amount is tempered by the delay interval and total number of cpus. This commit also satisfies the Debian 'top_nohz' patch (11/24/09) in a slightly more efficient manner. That patch concerned kernels built with CONFIG_NO_HZ. Reference: http://www.freelists.org/post/procps/CStates-handling-new-switch,4
This commit is contained in:
parent
f348575edc
commit
a9041a5526
@ -3324,13 +3324,18 @@ static void summaryhlp (CPU_t *cpu, const char *pfx) {
|
||||
s_frme = TRIMz(cpu->cur.s - cpu->sav.s);
|
||||
n_frme = TRIMz(cpu->cur.n - cpu->sav.n);
|
||||
i_frme = TRIMz(cpu->cur.i - cpu->sav.i);
|
||||
if ((u_frme == 0) && (i_frme == 0)) i_frme = 100;
|
||||
w_frme = TRIMz(cpu->cur.w - cpu->sav.w);
|
||||
x_frme = TRIMz(cpu->cur.x - cpu->sav.x);
|
||||
y_frme = TRIMz(cpu->cur.y - cpu->sav.y);
|
||||
z_frme = TRIMz(cpu->cur.z - cpu->sav.z);
|
||||
tot_frme = u_frme + s_frme + n_frme + i_frme + w_frme + x_frme + y_frme + z_frme;
|
||||
#ifdef CPU_ZEROTICS
|
||||
if (1 > tot_frme) tot_frme = 1;
|
||||
#else
|
||||
if (tot_frme < ((smp_num_cpus * 10) * Rc.delay_time))
|
||||
tot_frme = u_frme = s_frme = n_frme = i_frme = w_frme = x_frme = y_frme = z_frme = 0;
|
||||
if (1 > tot_frme) i_frme = tot_frme = 1;
|
||||
#endif
|
||||
scale = 100.0 / (float)tot_frme;
|
||||
|
||||
/* display some kinda' cpu state percentages
|
||||
|
@ -27,6 +27,7 @@
|
||||
//#define ATEOJ_RPTSTD /* report on misc stuff, at end-of-job */
|
||||
//#define CASEUP_HEXES /* show any hex values in upper case */
|
||||
//#define CASEUP_SUFIX /* show time/mem/cnts suffix in upper case */
|
||||
//#define CPU_ZEROTICS /* tolerate few tics when cpu off vs. idle */
|
||||
//#define EQUCOLHDRYES /* yes, do equalize column header lengths */
|
||||
//#define OFF_HST_HASH /* use BOTH qsort+bsrch vs. hashing scheme */
|
||||
//#define OFF_STDIOLBF /* disable our own stdout _IOFBF override */
|
||||
|
Loading…
Reference in New Issue
Block a user