Current-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

What magic be this?

This is really weird...

I run munin (from pkgsrc) on all my systems, and have just discovered
that since I upgraded back in January, I've had garbage data for
interrupt counters.  The problem is with 'vmstat -i':

tih@thuvia:~$ vmstat -i
interrupt          total rate
TLB shootdown   35940172  105
cpu0 timer      34055861   99
msi0 vec 0      21622982   63
ioapic0 pin 16  22272835   65
msi2 vec 0      15951915   46
msi3 vec 0      68120687  199
ioapic0 pin 18         1    0
ioapic0 pin 23       455    0
ioapic0 pin 19   4560598   13
Total           202525506  594

Looks good at first glance, right?  Now take a look at the printf
statements in /usr/src/usr.bin/vmstat/vmstat.c that did that:

(void)printf("%-34s %16s %8s\n", "interrupt", "total", "rate");
(void)printf("%-34s %16llu %8llu\n", intrname,

So what the heck is going on here?

I'd suggest that it's failing to accept the "%-34s" as a good format
spec, and using the %16 field width for the first data item, except that
it isn't that simple.  Here's output from another machine:

tih@sirius:~$ vmstat -i
interrupt        total rate
pic0 pin 14   10511350   13
pic0 pin 15         13    0
pic0 pin 10  139462222  182
pic0 pin 7     2162156    2
pic0 pin 4        1413    0
pic0 pin 0    76409573   99
Total        228546727  298

Yup.  It's adjusting the columns based on the max length of the first
field.  What the heck am I not seeing?

Most people who graduate with CS degrees don't understand the significance
of Lisp.  Lisp is the most important idea in computer science.  --Alan Kay

Home | Main Index | Thread Index | Old Index