Re: /proc/stat weirdness

From: Denis Vlasenko (vda@port.imtp.ilyichevsk.odessa.ua)
Date: Mon Apr 22 2002 - 06:41:26 EST


On 21 April 2002 16:27, Mark Hahn wrote:
> > * top with continuous update
> > * output of "while true; do cat /proc/stat; done | grep -F 'cpu '"
>
> I told you, I don't ever see any of this phenomenon.

I'd like to add that it is easily seen only on slower boxes.
It was really hard to catch on PIII 800 (1458 BogoMIPS):
top was too slow refreshing, cat script however was fast enough when
redirected to file to show backstepping. See below.

Hey lkml folks, please run:
# while true; do cat /proc/stat; done | grep -F 'cpu ' >/tmp/log
do you see something like this?

cpu 1170 0 3066 28631
cpu 1170 0 3066 28632
cpu 1170 0 3066 28634
cpu 1170 0 3067 28634
cpu 1171 0 3067 28634
cpu 1171 0 3067 28635 <<<
cpu 1171 0 3069 28634 <<<
cpu 1171 0 3070 28634 <<<
cpu 1171 0 3070 28635
cpu 1171 0 3070 28636
cpu 1172 0 3070 28637
cpu 1172 0 3071 28637

Or better yet, this hunter script:
#!/bin/sh
prev=0
while true; do cat /proc/stat; done | \
grep -F 'cpu ' | \
cut -d ' ' -f 6 | \
while read next; do
    diff=$(($next-$prev))
    if test $diff -lt 0; then
        echo "$prev -> $next"
    fi
    prev=$next
done

It will print only 'bad' idle counter pairs

--
vda
-
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 : Tue Apr 23 2002 - 22:00:30 EST