--- procps-2.0.2-orig/proc/sysinfo.c Sat Mar 20 12:38:48 1999 +++ procps-2.0.2/proc/sysinfo.c Mon Aug 16 13:44:06 1999 @@ -30,6 +30,8 @@ static int uptime_fd = -1; #define LOADAVG_FILE "/proc/loadavg" static int loadavg_fd = -1; +#define CPUINFO_FILE "/proc/cpuinfo" +static int cpuinfo_fd = -1; #define MEMINFO_FILE "/proc/meminfo" static int meminfo_fd = -1; @@ -103,6 +105,11 @@ unsigned long user_j, nice_j, sys_j, other_j; /* jiffies (clock ticks) */ double up_1, up_2, seconds; unsigned long jiffies, h; + unsigned int ncpu = 0; + char *p; + FILE_TO_BUF(CPUINFO_FILE,cpuinfo_fd); + for (p = buf; p = strstr(p, "processor"); p += 9) + ncpu++; do{ FILE_TO_BUF(UPTIME_FILE,uptime_fd); sscanf(buf, "%lf", &up_1); /* uptime(&up_1, NULL); */ @@ -111,7 +118,7 @@ FILE_TO_BUF(UPTIME_FILE,uptime_fd); sscanf(buf, "%lf", &up_2); /* uptime(&up_2, NULL); */ } while((long)( (up_2-up_1)*1000.0/up_1 )); /* want under 0.1% error */ - jiffies = user_j + nice_j + sys_j + other_j; + jiffies = (user_j + nice_j + sys_j + other_j) / ncpu; seconds = (up_1 + up_2) / 2; h = (unsigned long)( (double)jiffies/seconds ); switch(h){
*** Bug 4414 has been marked as a duplicate of this bug. *** "ps u" displays the wrong START time for processes
This should be fixed in procps-2.0.3, which is going onto the ftp sites now, and will be in the next RawHide and in Red Hat Linux 6.1