xref: /openbmc/linux/tools/testing/selftests/ftrace/test.d/kprobe/multiple_kprobes.tc (revision 4da722ca19f30f7db250db808d1ab1703607a932)
1#!/bin/sh
2# description: Register/unregister many kprobe events
3
4# ftrace fentry skip size depends on the machine architecture.
5# Currently HAVE_KPROBES_ON_FTRACE defined on x86 and powerpc64le
6case `uname -m` in
7  x86_64|i[3456]86) OFFS=5;;
8  ppc64le) OFFS=8;;
9  *) OFFS=0;;
10esac
11
12echo "Setup up to 256 kprobes"
13grep t /proc/kallsyms | cut -f3 -d" " | grep -v .*\\..* | \
14head -n 256 | while read i; do echo p ${i}+${OFFS} ; done > kprobe_events ||:
15
16echo 1 > events/kprobes/enable
17echo 0 > events/kprobes/enable
18echo > kprobe_events
19echo "Waiting for unoptimizing & freeing"
20sleep 5
21echo "Done"
22