1b1c3f9598f8470276c9e08e60ff2d42cf906e76
[ltt-control.git] / lttctl / ltt-armall.sh
1 # Copyright (C) 2009 Benjamin Poirier
2 # Copyright (C) 2010 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3
4 # This program is free software; you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation; either version 2 of the License, or
7 # (at your option) any later version.
8
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
13
14 # You should have received a copy of the GNU General Public License along
15 # with this program; if not, write to the Free Software Foundation, Inc.,
16 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17
18 DEBUGFSROOT=$(awk '{if ($3 == "debugfs") print $2}' /proc/mounts | head -n 1)
19 MARKERSROOT=${DEBUGFSROOT}/ltt/markers
20
21 usage () {
22 echo "Usage: $0 [OPTION]..." > /dev/stderr
23 echo "Connect lttng markers" > /dev/stderr
24 echo "" > /dev/stderr
25 echo "Options:" > /dev/stderr
26 printf "\t-l Also activate locking markers (high traffic)\n" > /dev/stderr
27 printf "\t-n Also activate detailed network markers (large size)\n" > /dev/stderr
28 printf "\t-i Also activate input subsystem events (security implication: records keyboard inputs)\n" > /dev/stderr
29 echo "" > /dev/stderr
30 printf "\t-q Quiet mode, suppress output\n" > /dev/stderr
31 printf "\t-h Print this help\n" > /dev/stderr
32 echo "" > /dev/stderr
33 }
34
35 if [ ! "${DEBUGFSROOT}" ]; then
36 echo "Error: debugfs not mounted" > /dev/stderr
37 exit 1;
38 fi
39
40 if [ ! -d "${MARKERSROOT}" ]; then
41 echo "Error: LTT trace controller not found (did you compile and load LTTng?)" > /dev/stderr
42 exit 1;
43 fi
44
45 while getopts "lnqh" options; do
46 case ${options} in
47 l) LOCKING="0";;
48 n) NETWORK="0";;
49 q) QUIET="0";;
50 i) INPUT="0";;
51 h) usage;
52 exit 0;;
53 \?) usage;
54 exit 1;;
55 esac
56 done
57 shift $((${OPTIND} - 1))
58
59
60 if [ ! ${LOCKING} ]; then
61 TESTS="${TESTS} -name lockdep -prune -o -name locking -prune -o"
62 fi
63
64 if [ ! ${NETWORK} ]; then
65 TESTS="${TESTS} -path '*/net/*_extended' -prune -o"
66 fi
67
68 if [ ! ${INPUT} ]; then
69 TESTS="${TESTS} -name input -prune -o"
70 fi
71
72 (eval "find '${MARKERSROOT}' ${TESTS} -name metadata -prune -o -name enable -print") | while read -r marker; do
73 if [ ! ${QUIET} ]; then
74 echo "Connecting ${marker%/enable}"
75 fi
76 echo 1 > ${marker}
77 done
This page took 0.030603 seconds and 3 git commands to generate.