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