void-packages/srcpkgs/procps/patches/sysinfo_7_numbers.patch

37 lines
1.7 KiB
Diff

Author: Craig Small <csmall@debian.org>
Description: Adds up 7 cpu numbers not 4
Bug-Debian: http://bugs.debian.org/460331
Index: b/proc/sysinfo.c
===================================================================
--- a/proc/sysinfo.c 2009-11-24 21:00:38.000000000 +1100
+++ b/proc/sysinfo.c 2009-11-24 21:00:42.000000000 +1100
@@ -124,24 +124,25 @@
unsigned long long Hertz;
static void old_Hertz_hack(void){
- unsigned long long user_j, nice_j, sys_j, other_j; /* jiffies (clock ticks) */
+ unsigned long long user_j, nice_j, sys_j, other_j, wait_j, hirq_j, sirq_j, stol_j; /* jiffies (clock ticks) */
double up_1, up_2, seconds;
unsigned long long jiffies;
unsigned h;
char *restrict savelocale;
+ wait_j = hirq_j = sirq_j = stol_j = 0;
savelocale = setlocale(LC_NUMERIC, NULL);
setlocale(LC_NUMERIC, "C");
do{
FILE_TO_BUF(UPTIME_FILE,uptime_fd); sscanf(buf, "%lf", &up_1);
/* uptime(&up_1, NULL); */
FILE_TO_BUF(STAT_FILE,stat_fd);
- sscanf(buf, "cpu %Lu %Lu %Lu %Lu", &user_j, &nice_j, &sys_j, &other_j);
+ sscanf(buf, "cpu %Lu %Lu %Lu %Lu %Lu %Lu %Lu %Lu", &user_j, &nice_j, &sys_j, &other_j, &wait_j, &hirq_j, &sirq_j, &stol_j);
FILE_TO_BUF(UPTIME_FILE,uptime_fd); sscanf(buf, "%lf", &up_2);
/* uptime(&up_2, NULL); */
} while((long long)( (up_2-up_1)*1000.0/up_1 )); /* want under 0.1% error */
setlocale(LC_NUMERIC, savelocale);
- jiffies = user_j + nice_j + sys_j + other_j;
+ jiffies = user_j + nice_j + sys_j + other_j + wait_j + hirq_j + sirq_j + stol_j ;
seconds = (up_1 + up_2) / 2;
h = (unsigned)( (double)jiffies/seconds/smp_num_cpus );
/* actual values used by 2.4 kernels: 32 64 100 128 1000 1024 1200 */