-
Notifications
You must be signed in to change notification settings - Fork 5
/
ksm
84 lines (71 loc) · 2.01 KB
/
ksm
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
#!/bin/bash
# Copyright(c) 2010.
# * Jonas Forsberg
# * Jimmy Hedman
#
# This file may be licensed under the terms of of the
# GNU General Public License Version 2 (the ``GPL'').
#
# Software distributed under the License is distributed
# on an ``AS IS'' basis, WITHOUT WARRANTY OF ANY KIND, either
# express or implied. See the GPL for the specific language
# governing rights and limitations.
#
# You should have received a copy of the GPL along with this
# program. If not, go to http://www.gnu.org/licenses/gpl.html
# or write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#%# family=test
#%# capabilities=autoconf
SYSPATH="/sys/kernel/mm/ksm/"
KSMFILES="pages_shared pages_unshared pages_volatile pages_sharing"
do_ () {
# Test if sys-files for KSM are present
for f in $KSMFILES
do
if [ ! -f "${SYSPATH}${f}" ]; then
echo "Unable to find file: ${SYSPATH}${f}" >&2
fi
done
echo shared.value $(cat ${SYSPATH}pages_shared)
echo unshared.value $(cat ${SYSPATH}pages_unshared)
echo volatile.value $(cat ${SYSPATH}pages_volatile)
echo sharing.value $(cat ${SYSPATH}pages_sharing)
}
do_autoconf () {
for f in $KSMFILES
do
if [ ! -f "${SYSPATH}${f}" ]; then
echo "no (Unable to find file: ${SYSPATH}${f})"
exit 0
fi
done
echo "yes"
}
do_config () {
cat <<EOF
graph_title KSM pages
graph_info Memory pages used by KSM
graph_vlabel Memory pages
graph_category system
graph_args --base 1000 -l 0
graph_scale yes
shared.label Shared
shared.info Number of shared memory pages
shared.type GAUGE
shared.draw AREA
unshared.label Unshared
unshared.info Number of memory pages aviable for sharing
unshared.type GAUGE
unshared.draw STACK
volatile.label Volatile
volatile.info Non shareble memory pages
volatile.type GAUGE
volatile.draw STACK
sharing.label Sharing
sharing.info An indication of memory pages savings
sharing.type GAUGE
sharing.draw LINE2
EOF
}
do_$1