--- linux/include/asm-i386/param.h.hz Mon Aug 18 12:15:42 2003 +++ linux/include/asm-i386/param.h Mon Aug 18 12:26:26 2003 @@ -2,8 +2,9 @@ #define _ASMi386_PARAM_H #ifndef HZ -#define HZ 100 +#define HZ 1000 #endif +#define jiffies_to_clock_t(x) ((x) / (HZ / 100)) #define EXEC_PAGESIZE 4096 --- linux/kernel/sys.c.hz Mon Aug 18 12:15:36 2003 +++ linux/kernel/sys.c Mon Aug 18 12:26:20 2003 @@ -807,10 +807,16 @@ * atomically safe type this is just fine. Conceptually its * as if the syscall took an instant longer to occur. */ - if (tbuf) - if (copy_to_user(tbuf, ¤t->times, sizeof(struct tms))) + if (tbuf) { + struct tms tmp; + tmp.tms_utime = jiffies_to_clock_t(current->times.tms_utime); + tmp.tms_stime = jiffies_to_clock_t(current->times.tms_stime); + tmp.tms_cutime = jiffies_to_clock_t(current->times.tms_cutime); + tmp.tms_cstime = jiffies_to_clock_t(current->times.tms_cstime); + if (copy_to_user(tbuf, &tmp, sizeof(struct tms))) return -EFAULT; - return jiffies; + } + return jiffies_to_clock_t(jiffies); } /* --- linux/kernel/timer.c.hz Wed Dec 4 11:01:40 2002 +++ linux/kernel/timer.c Mon Aug 18 12:15:42 2003 @@ -472,6 +472,15 @@ else time_adj += (time_adj >> 2) + (time_adj >> 5); #endif +#if HZ == 1000 + /* Compensate for (HZ==1000) != (1 << SHIFT_HZ). + * Add 1.5625% and 0.78125% to get 1023.4375; => only 0.05% error (p. 14) + */ + if (time_adj < 0) + time_adj -= (-time_adj >> 6) + (-time_adj >> 7); + else + time_adj += (time_adj >> 6) + (time_adj >> 7); +#endif } /* in the NTP reference this is called "hardclock()" */ --- linux/fs/proc/array.c.hz 2003-11-30 21:52:24.000000000 +0100 +++ linux/fs/proc/array.c 2003-11-30 21:52:26.000000000 +0100 @@ -362,15 +362,15 @@ task->cmin_flt, task->maj_flt, task->cmaj_flt, - task->times.tms_utime, - task->times.tms_stime, - task->times.tms_cutime, - task->times.tms_cstime, + jiffies_to_clock_t(task->times.tms_utime), + jiffies_to_clock_t(task->times.tms_stime), + jiffies_to_clock_t(task->times.tms_cutime), + jiffies_to_clock_t(task->times.tms_cstime), priority, nice, 0UL /* removed */, task->it_real_value, - task->start_time, + jiffies_to_clock_t(task->start_time), vsize, mm ? mm->rss : 0, /* you might want to shift this left 3 */ task->rlim[RLIMIT_RSS].rlim_cur, --- linux/fs/proc/proc_misc.c.hz Mon Aug 18 12:15:26 2003 +++ linux/fs/proc/proc_misc.c Mon Aug 18 13:35:59 2003 @@ -325,18 +325,21 @@ } proc_sprintf(page, &off, &len, - "cpu %u %u %u %lu\n", user, nice, system, - jif * smp_num_cpus - (user + nice + system)); + "cpu %u %u %u %lu\n", + jiffies_to_clock_t(user), + jiffies_to_clock_t(nice), + jiffies_to_clock_t(system), + jiffies_to_clock_t(jif * smp_num_cpus - (user + nice + system))); for (i = 0 ; i < smp_num_cpus; i++) proc_sprintf(page, &off, &len, "cpu%d %u %u %u %lu\n", i, - kstat.per_cpu_user[cpu_logical_map(i)], - kstat.per_cpu_nice[cpu_logical_map(i)], - kstat.per_cpu_system[cpu_logical_map(i)], - jif - ( kstat.per_cpu_user[cpu_logical_map(i)] \ + jiffies_to_clock_t(kstat.per_cpu_user[cpu_logical_map(i)]), + jiffies_to_clock_t(kstat.per_cpu_nice[cpu_logical_map(i)]), + jiffies_to_clock_t(kstat.per_cpu_system[cpu_logical_map(i)]), + jiffies_to_clock_t(jif - ( kstat.per_cpu_user[cpu_logical_map(i)] \ + kstat.per_cpu_nice[cpu_logical_map(i)] \ - + kstat.per_cpu_system[cpu_logical_map(i)])); + + kstat.per_cpu_system[cpu_logical_map(i)]))); proc_sprintf(page, &off, &len, "page %u %u\n" "swap %u %u\n"