Re: Unknown HZ value! (1908) Assume 1024.

From: Tom Holroyd (tomh@po.crl.go.jp)
Date: Tue Feb 19 2002 - 04:29:03 EST


> > /proc/stat:
> > cpu 2427984276 2540057284 67737892 4296620451
> > cpu0 2427984276 2540057284 67737892 4296620451
> > ...
> >
> I'd suggest changing the declarations in kstat_read_proc to
>
> unsigned long jif = jiffies, user = 0, nice = 0, system = 0;
> unsigned int sum = 0;
>
> so that ticks that are lost due to overflow count as "other".

Isn't it also necessary to change the sprintf() format strings to %lu?
That is,
        len = sprintf(page, "cpu %lu %lu %lu %lu\n", user, nice, system,
                      jif * smp_num_cpus - (user + nice + system));

Also, it looks like the per_cpu loop that follows the sprintf() also
has this bug, i.e., adding three ints to get a long. Short of making
the kstat fields longs, it should suffice to just use a cast there,
and adjust the related sprintf(), e.g., to
                len += sprintf(page + len, "cpu%d %lu %lu %lu %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 -
           ((unsigned long) kstat.per_cpu_user[cpu_logical_map(i)] +
                            kstat.per_cpu_nice[cpu_logical_map(i)] +
                            kstat.per_cpu_system[cpu_logical_map(i)]));

Might be worth sticking
        int cpu = cpu_logical_map(i);

at the top of the loop too, to clean that code up a bit.

Anyway, I'll have a go at the above and get back to you in about 48.5
days. :-)

Thanks!

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Sat Feb 23 2002 - 21:00:18 EST