1#!/bin/sh
2# SPDX-License-Identifier: GPL-2.0
3# description: Generic dynamic event - selective clear (compatibility)
4
5[ -f dynamic_events ] || exit_unsupported
6
7grep -q "place: \[<module>:\]<symbol>" README || exit_unsupported
8grep -q "place (kretprobe): \[<module>:\]<symbol>" README || exit_unsupported
9
10grep -q "s:\[synthetic/\]" README || exit_unsupported
11
12[ -f synthetic_events ] || exit_unsupported
13[ -f kprobe_events ] || exit_unsupported
14
15echo 0 > events/enable
16echo > dynamic_events
17
18PLACE=_do_fork
19
20setup_events() {
21echo "p:myevent1 $PLACE" >> dynamic_events
22echo "s:latency1 u64 lat; pid_t pid;" >> dynamic_events
23echo "r:myevent2 $PLACE" >> dynamic_events
24echo "s:latency2 u64 lat; pid_t pid;" >> dynamic_events
25
26grep -q myevent1 dynamic_events
27grep -q myevent2 dynamic_events
28grep -q latency1 dynamic_events
29grep -q latency2 dynamic_events
30}
31
32setup_events
33echo > synthetic_events
34
35grep -q myevent1 dynamic_events
36grep -q myevent2 dynamic_events
37! grep -q latency1 dynamic_events
38! grep -q latency2 dynamic_events
39
40echo > dynamic_events
41
42setup_events
43echo > kprobe_events
44
45! grep -q myevent1 dynamic_events
46! grep -q myevent2 dynamic_events
47grep -q latency1 dynamic_events
48grep -q latency2 dynamic_events
49
50echo > dynamic_events
51