summaryrefslogtreecommitdiff
path: root/tools/testing/selftests/ftrace/test.d/trigger/inter-event/trigger-snapshot-action-hist.tc
blob: f546c1b66a9b1d0b58bfa2a247a525d7e9647b25 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/bin/sh
# SPDX-License-Identifier: GPL-2.0
# description: event trigger - test inter-event histogram trigger snapshot action

fail() { #msg
    echo $1
    exit_fail
}

if [ ! -f set_event ]; then
    echo "event tracing is not supported"
    exit_unsupported
fi

if [ ! -f snapshot ]; then
    echo "snapshot is not supported"
    exit_unsupported
fi

grep -q "onchange(var)" README || exit_unsupported # version issue

grep -q "snapshot()" README || exit_unsupported # version issue

echo "Test snapshot action"

echo 1 > events/sched/enable

echo 'hist:keys=comm:newprio=prio:onchange($newprio).save(comm,prio):onchange($newprio).snapshot() if comm=="ping"' >> events/sched/sched_waking/trigger

ping $LOCALHOST -c 3
nice -n 1 ping $LOCALHOST -c 3

echo 0 > tracing_on

if ! grep -q "changed:" events/sched/sched_waking/hist; then
    fail "Failed to create onchange action inter-event histogram"
fi

if ! grep -q "comm=ping" snapshot; then
    fail "Failed to create snapshot action inter-event histogram"
fi

exit 0