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
|
#! /bin/sh
# PCP QA Test No. 361
# Exercise cgroup metrics in the Linux PMDA
#
# Copyright (c) 2010 Aconex. All Rights Reserved.
#
seq=`basename $0`
echo "QA output created by $seq"
# get standard filters
. ./common.product
. ./common.check
. ./localconfig
[ $PCP_PLATFORM = linux ] || _notrun "tests pmdalinux functionality on Linux only"
rm -f $seq.out
# cgroup metrics may not be available
#
if pminfo cgroup >/dev/null 2>&1
then
prefix=cgroup
ln $seq.out.2 $seq.out
else
if pminfo proc.cgroup >/dev/null 2>&1
then
prefix=proc.cgroup
ln $seq.out.1 $seq.out
else
_notrun cgroup metrics not available
fi
fi
_cleanup()
{
rm -f $tmp.*
$sudo umount $grp 2>/dev/null
rmdir $grp 2>/dev/null
}
grp=/tmp/cgroup_$seq
status=1 # failure is the default!
trap "_cleanup; exit \$status" 0 1 2 3 15
[ -f /proc/cgroups ] || _notrun "No support for cgroups in the running kernel"
grep -q cgroup /proc/mounts && _notrun "One or more cgroups already in use"
grep -q cpuacct /proc/cgroups || _notrun "No cpuacct cgroup support"
grep -q cpuset /proc/cgroups || _notrun "No cpuset cgroup support"
grep -q cpu /proc/cgroups || _notrun "No cpusched cgroup support"
rmdir $grp 2>/dev/null
mkdir $grp || _fail "Cannot create cgroup mount point"
# since the proc PMDA was split from the Linux PMDA, the proc PMDA may
# not be installed (caught by the notrun cases above) or installed as
# a daemon, in which case the standard processing of pmcd.conf for
# a local PMAPI context connection will not find it, so may have to
# be specific about the proc PMDA DSO location
#
pmda="-Kclear -Kadd,3,$PCP_PMDAS_DIR/proc/pmda_proc.so,proc_init"
# real test starts here
echo "initial fetch, starting with a clean slate"
pmprobe -L $pmda -v $prefix.mounts \
| LC_COLLATE=POSIX sort
echo "cpuset metrics fetch, no user groups defined, single controller"
$sudo mount -t cgroup -o cpuset none $grp || _fail "cpuset mount"
pminfo -L $pmda -m $prefix.mounts $prefix.groups \
| LC_COLLATE=POSIX sort
$sudo umount $grp || _fail "cpuset umount"
echo "cpuacct and cpuset fetch, no user groups defined, dual controllers"
$sudo mount -t cgroup -o cpuacct,cpuset none $grp || _fail "cpu,cpuacct mount"
pminfo -L $pmda -m $prefix.mounts $prefix.groups \
| LC_COLLATE=POSIX sort
$sudo umount $grp || _fail "cpu,cpuacct cgroup umount"
echo "cpuacct and cpuset fetch, one user group defined, dual controllers"
$sudo mount -t cgroup -o cpuacct,cpuset none $grp || _fail "cpu,cpuacct mount"
$sudo mkdir $grp/pcpqa
pminfo -L $pmda $prefix.mounts $prefix.groups \
| LC_COLLATE=POSIX sort \
| xargs pminfo -L -d $pmda -m
$sudo rmdir $grp/pcpqa
echo "cpuacct and cpuset fetch, one user group removed, dual controllers"
pminfo -L $pmda $prefix.mounts $prefix.groups \
| LC_COLLATE=POSIX sort \
| xargs pminfo -L -d $pmda -m
$sudo umount $grp || _fail "cpu,cpuacct cgroup umount"
# success, all done
status=0
exit
|