Commit | Line | Data |
---|---|---|
045880fb BP |
1 | #!/bin/bash |
2 | # Copyright (C) 2009 Benjamin Poirier | |
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 | ||
80bb2806 | 18 | DEBUGFSROOT=$(grep ^debugfs /proc/mounts | head -1 | awk '{print $2}') |
19 | MARKERSROOT=${DEBUGFSROOT}/ltt/markers | |
20 | ||
045880fb BP |
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 | echo "" > /dev/stderr | |
29 | printf "\t-q Quiet mode, suppress output\n" > /dev/stderr | |
30 | printf "\t-h Print this help\n" > /dev/stderr | |
31 | echo "" > /dev/stderr | |
32 | } | |
33 | ||
34 | if [ ! "$DEBUGFSROOT" ]; then | |
35 | echo "Error: debugfs not mounted" > /dev/stderr | |
36 | exit 1; | |
37 | fi | |
38 | ||
39 | if [ ! -d "$MARKERSROOT" ]; then | |
40 | echo "Error: LTT trace controller not found (did you compile and load LTTng?)" > /dev/stderr | |
41 | exit 1; | |
42 | fi | |
43 | ||
44 | while getopts "lnqh" options; do | |
45 | case $options in | |
46 | l) LOCKING="0";; | |
47 | n) NETWORK="0";; | |
48 | q) QUIET="0";; | |
49 | h) usage; | |
50 | exit 0;; | |
51 | \?) usage; | |
52 | exit 1;; | |
80bb2806 | 53 | esac |
54 | done | |
045880fb BP |
55 | shift $(($OPTIND - 1)) |
56 | ||
57 | ||
58 | if [ ! $LOCKING ]; then | |
59 | TESTS="${TESTS} -name lockdep -prune -o -name locking -prune -o" | |
60 | fi | |
61 | ||
62 | if [ ! $NETWORK ]; then | |
63 | TESTS="${TESTS} -path '*/net/*_extended' -prune -o" | |
64 | fi | |
65 | ||
66 | while read -r -d $'\0' marker; do | |
67 | if [ ! $QUIET ]; then | |
68 | echo "Connecting ${marker%/enable}" | |
69 | fi | |
70 | echo 1 > $marker | |
71 | done < <(eval "find '$MARKERSROOT' $TESTS -name metadata -prune -o -name enable -print0") |