2 # Copyright (C) 2017 - Francis Deslauriers <francis.deslauriers@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 3 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
15 # along with this program. If not, see <http://www.gnu.org/licenses/>.
17 NB_KPROBE_PER_ITER
=500
18 SESSION_NAME
="my_kprobe_session"
20 # Silence the script to avoid redirection of kallsyms to fill the screen
22 syms
=$
(awk '{print $3;}' /proc
/kallsyms |
sort -R)
23 nb_syms
=$
(echo "$syms" |
wc -l)
26 # Loop over the list of symbols and enable the symbols in groups of
28 for i
in $
(seq 0 "$NB_KPROBE_PER_ITER" "$nb_syms"); do
29 # Pick $NB_KPROBE_PER_ITER symbols to instrument, craft enable-event
30 # command and save them to a file. We craft the commands and executed
31 # them in two steps so that the pipeline can be done without the bash
32 # '-x' option that would fill the serial buffer because of the multiple
35 echo "$syms" |
head -n $
((i
+NB_KPROBE_PER_ITER
)) |
tail -n $NB_KPROBE_PER_ITER |
awk '{print "lttng enable-event --kernel --function=" $1 " " $1}' > lttng-enable-event.sh
38 # Print what iteration we are at
39 echo "$i" $
((i
+NB_KPROBE_PER_ITER
))
41 # Destroy previous session and create a new one
42 lttng create
"$SESSION_NAME"
44 # Expect commands to fail, turn off early exit of shell script on
45 # non-zero return value
47 source .
/lttng-enable-event.sh
50 # Run stress util to generate some kernel activity
51 stress
--cpu 2 --io 4 --vm 2 --vm-bytes 128M
--hdd 3 --timeout 5s
53 lttng list
"$SESSION_NAME"
54 lttng destroy
"$SESSION_NAME"
This page took 0.029793 seconds and 4 git commands to generate.