Commit | Line | Data |
---|---|---|
146459fe TZ |
1 | #!/bin/sh |
2 | # SPDX-License-Identifier: GPL-2.0 | |
3 | # description: event trigger - test inter-event histogram trigger snapshot action | |
1b8eec51 | 4 | # requires: set_event snapshot events/sched/sched_process_fork/hist "onchange(var)":README "snapshot()":README |
146459fe TZ |
5 | |
6 | fail() { #msg | |
7 | echo $1 | |
8 | exit_fail | |
9 | } | |
10 | ||
146459fe TZ |
11 | echo "Test snapshot action" |
12 | ||
ba1b9c50 | 13 | echo 1 > events/sched/enable |
146459fe | 14 | |
ba1b9c50 | 15 | echo 'hist:keys=comm:newprio=prio:onchange($newprio).save(comm,prio):onchange($newprio).snapshot() if comm=="ping"' >> events/sched/sched_waking/trigger |
146459fe TZ |
16 | |
17 | ping $LOCALHOST -c 3 | |
18 | nice -n 1 ping $LOCALHOST -c 3 | |
19 | ||
20 | echo 0 > tracing_on | |
21 | ||
22 | if ! grep -q "changed:" events/sched/sched_waking/hist; then | |
23 | fail "Failed to create onchange action inter-event histogram" | |
24 | fi | |
25 | ||
26 | if ! grep -q "comm=ping" snapshot; then | |
27 | fail "Failed to create snapshot action inter-event histogram" | |
28 | fi | |
29 | ||
30 | exit 0 |