1#!/bin/sh 2# SPDX-License-Identifier: GPL-2.0 3# description: Generic dynamic event - generic clear event 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 12echo 0 > events/enable 13echo > dynamic_events 14 15PLACE=_do_fork 16 17setup_events() { 18echo "p:myevent1 $PLACE" >> dynamic_events 19echo "s:latency1 u64 lat; pid_t pid;" >> dynamic_events 20echo "r:myevent2 $PLACE" >> dynamic_events 21echo "s:latency2 u64 lat; pid_t pid;" >> dynamic_events 22 23grep -q myevent1 dynamic_events 24grep -q myevent2 dynamic_events 25grep -q latency1 dynamic_events 26grep -q latency2 dynamic_events 27} 28 29setup_events 30 31echo "!p:myevent1 $PLACE" >> dynamic_events 32! grep -q myevent1 dynamic_events 33grep -q myevent2 dynamic_events 34grep -q latency1 dynamic_events 35grep -q latency2 dynamic_events 36 37echo "!s:latency1 u64 lat; pid_t pid;" >> dynamic_events 38grep -q myevent2 dynamic_events 39! grep -q latency1 dynamic_events 40grep -q latency2 dynamic_events 41 42echo "!r:myevent2 $PLACE" >> dynamic_events 43! grep -q myevent2 dynamic_events 44grep -q latency2 dynamic_events 45 46echo "!s:latency2 u64 lat; pid_t pid;" >> dynamic_events 47! grep -q latency2 dynamic_events 48 49echo > dynamic_events 50