1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69
|
#!/bin/sh
# PCP QA Test No. 1104
# Check kernel.all.cpu.* against kernel.percpu.cpu.*
#
# Copyright (c) 2019 Ken McDonell. All Rights Reserved.
#
seq=`basename $0`
echo "QA output created by $seq"
# get standard environment, filters and checks
. ./common.product
. ./common.filter
. ./common.check
_cleanup()
{
cd $here
$sudo rm -rf $tmp $tmp.*
}
status=1 # failure is the default!
trap "_cleanup; exit \$status" 0 1 2 3 15
# real QA test starts here
echo "Silence is golden"
pmprobe -v kernel.all.cpu kernel.percpu.cpu >$tmp.raw
cat $tmp.raw >$seq_full
grep '^kernel\.all\.cpu' $tmp.raw \
| while read all_metric all_numval all_value
do
echo $all_metric $all_value >>$seq_full
percpu_metric=`echo "$all_metric" | sed -e 's/all/percpu/'`
percpu_numval=`grep "^$percpu_metric " $tmp.raw | $PCP_AWK_PROG '{ print $2 }'`
ok=true
if [ "$percpu_numval" -eq 0 ]
then
if [ "$all_numval" -eq 0 ]
then
# No values available for both, this is OK
continue
else
ok=false
fi
elif [ "$all_numval" -lt 0 ]
then
ok=false
elif [ "$percpu_numval" -lt 0 ]
then
ok=false
fi
if $ok
then
sum_value=`grep "^$percpu_metric " $tmp.raw \
| $PCP_AWK_PROG '
{ s = $3; for (i = 4; i <= NF; i++) s += $i; print s }'`
echo $percpu_metric $sum_value >>$seq_full
_within_tolerance $all_metric $all_value $sum_value 5%
else
echo "Error: $all_metric numval=$all_numval, $percpu_metric numval=$percpu_numval !"
fi
done
# success, all done
status=0
exit
|