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 # Print time in UTC at each iteration to easily see when the script
33 # Pick $NB_KPROBE_PER_ITER symbols to instrument, craft enable-event
34 # command and save them to a file. We craft the commands and executed
35 # them in two steps so that the pipeline can be done without the bash
36 # '-x' option that would fill the serial buffer because of the multiple
39 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
42 # Print what iteration we are at
43 echo "$i" $
((i
+NB_KPROBE_PER_ITER
))
45 # Destroy previous session and create a new one
46 lttng create
"$SESSION_NAME"
48 # Expect commands to fail, turn off early exit of shell script on
49 # non-zero return value
51 source .
/lttng-enable-event.sh
54 # Run stress util to generate some kernel activity
55 stress
--cpu 2 --io 4 --vm 2 --vm-bytes 128M
--hdd 3 --timeout 5s
57 lttng list
"$SESSION_NAME"
58 lttng destroy
"$SESSION_NAME"
This page took 0.048608 seconds and 4 git commands to generate.