File: 747

package info (click to toggle)
pcp 7.1.0-1
  • links: PTS
  • area: main
  • in suites: forky, sid
  • size: 252,748 kB
  • sloc: ansic: 1,483,656; sh: 182,366; xml: 160,462; cpp: 83,813; python: 24,980; perl: 18,327; yacc: 6,877; lex: 2,864; makefile: 2,738; awk: 165; fortran: 60; java: 52
file content (110 lines) | stat: -rwxr-xr-x 3,001 bytes parent folder | download
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
#!/bin/sh
# PCP QA Test No. 747
# Exercise Linux hardware inventory online/offline metrics.
#
# Copyright (c) 2014,2020 Red Hat.
#

seq=`basename $0`
echo "QA output created by $seq"

# get standard environment, filters and checks
. ./common.product
. ./common.filter
. ./common.check

[ $PCP_PLATFORM = linux ] || _notrun "Linux sysfs test, only works with Linux"

status=1	# failure is the default!
mkdir -p $tmp.root

trap "cd $here; $sudo rm -rf $tmp.*; exit \$status" 0 1 2 3 15

_sort_instname()
{
    $sudo rm -f $tmp.sort
    tee $tmp.sort | sed -n 2p
    awk '/inst / {print "  ", $4, $6}' $tmp.sort | sed -e 's/\]//' | LC_COLLATE=POSIX sort
}

# real QA test starts here
LINUX_HERTZ=100; export LINUX_HERTZ
LINUX_STATSPATH=$tmp.root; export LINUX_STATSPATH
pmda=$PCP_PMDAS_DIR/linux/pmda_linux.so,linux_init
local="-L -K clear -K add,60,$pmda"

online_metrics="hinv.cpu.online hinv.node.online"
allcpu_metrics=`pminfo $local kernel.all.cpu | LC_COLLATE=POSIX sort`
percpu_metrics=`pminfo $local kernel.percpu.cpu | LC_COLLATE=POSIX sort`
pernode_metrics=`pminfo $local kernel.pernode.cpu | LC_COLLATE=POSIX sort`
thermal_metrics=`pminfo $local hinv.cpu.thermal_throttle| LC_COLLATE=POSIX sort`
cpufreq_metrics=`pminfo $local hinv.cpu.frequency_scaling | LC_COLLATE=POSIX sort`

for tgz in $here/linux/sysdev-*.tgz $here/linux/sysfs-numa-001.tgz
do
    $sudo rm -fr $tmp.root/*
    cd $tmp.root
    $sudo tar xzf $tgz
    base=`basename $tgz`

    echo "=== $base ===" >>$seq_full

    # need the number of cpus in this data set ... from the number of
    # lines like
    # cpu7 850802 2207 394292 41789513 119722 1143651 200784 0 0 0
    # in proc/stat
    #
    if [ ! -f proc/stat ]
    then
	echo "Arrgh, proc/stat not included in $base stats tarball"
	exit
    fi
    LINUX_NCPUS=`grep '^cpu[0-9][0-9]* ' proc/stat | wc -l | sed -e 's/ //g'`
    export LINUX_NCPUS
    echo "LINUX_NCPUS=$LINUX_NCPUS" >>$seq_full

    echo "== Checking hinv online metric values - $base"
    for m in $online_metrics
    do
	pminfo $local -f $m | _sort_instname
    done
    echo && echo "== done" && echo

    echo "== Checking aggregate CPU metric values - $base"
    pminfo $local -f $allcpu_metrics
    echo && echo "== done" && echo

    echo "== Checking per-CPU metric values - $base"
    for m in $percpu_metrics
    do
	pminfo $local -f $m | _sort_instname
    done
    echo && echo "== done" && echo

    echo "== Checking per-node CPU metric values - $base"
    for m in $pernode_metrics
    do
	pminfo $local -f $m | _sort_instname
    done
    echo && echo "== done" && echo

    echo "== Checking hinv thermal_throttle values - $base"
    for m in $thermal_metrics
    do
	pminfo $local -f $m | _sort_instname
    done
    echo && echo "== done" && echo

    echo "== Checking hinv frequency_scaling values - $base"
    for m in $cpufreq_metrics
    do
	pminfo $local -f $m | _sort_instname
    done
    echo && echo "== done" && echo

    cd $here
done

# success, all done
status=0
exit