1 # Copyright (C) 2009 Benjamin Poirier
2 # Copyright (C) 2010 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
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.
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.
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.
18 DEBUGFSROOT
=$
(awk '{if ($3 == "debugfs") print $2}' /proc
/mounts |
head -n 1)
19 MARKERSROOT
=${DEBUGFSROOT}/ltt
/markers
20 DEFAULTMODULES
="ltt-trace-control ltt-marker-control ltt-tracer ltt-relay ltt-kprobes ltt-userspace-event ltt-statedump ipc-trace kernel-trace mm-trace net-trace fs-trace jbd2-trace syscall-trace trap-trace block-trace rcu-trace"
23 echo "Usage: $0 [OPTION]..." 1>&2
24 echo "Connect lttng markers" 1>&2
27 printf "\t-l Also activate locking markers (high traffic)\n" 1>&2
28 printf "\t-n Also activate detailed network markers (large size)\n" 1>&2
29 printf "\t-i Also activate input subsystem events (security implication: records keyboard inputs)\n" 1>&2
31 printf "\t-q Quiet mode, suppress output\n" 1>&2
32 printf "\t-h Print this help\n" 1>&2
36 if [ "$(id -u)" != "0" ]; then
37 echo "Error: This script needs to be run as root." 1>&2
41 if [ ! "${DEBUGFSROOT}" ]; then
42 echo "Error: debugfs not mounted" 1>&2
46 if [ ! -d "${MARKERSROOT}" ]; then
47 #Try loading the kernel modules first
48 for i
in ${DEFAULTMODULES}; do
51 if [ ! -d "${MARKERSROOT}" ]; then
52 echo "Error: LTT trace controller not found (did you compile and load LTTng?)" 1>&2
57 while getopts "lnqh" options
; do
69 shift $
((${OPTIND} - 1))
72 if [ ! ${LOCKING} ]; then
73 TESTS
="${TESTS} -name lockdep -prune -o -name locking -prune -o"
75 modprobe lockdep-trace
78 if [ ! ${NETWORK} ]; then
79 TESTS
="${TESTS} -path '*/net/*_extended' -prune -o"
81 modprobe net-extended-trace
84 if [ ! ${INPUT} ]; then
85 TESTS
="${TESTS} -name input -prune -o"
88 (eval "find '${MARKERSROOT}' ${TESTS} -name metadata -prune -o -name enable -print") |
while read -r marker
; do
89 if [ ! ${QUIET} ]; then
90 echo "Connecting ${marker%/enable}"