1#!/bin/sh
2# SPDX-License-Identifier: GPL-2.0
3# description: event trigger - test inter-event histogram trigger onchange action
4
5fail() { #msg
6    echo $1
7    exit_fail
8}
9
10if [ ! -f set_event ]; then
11    echo "event tracing is not supported"
12    exit_unsupported
13fi
14
15grep -q "onchange(var)" README || exit_unsupported # version issue
16
17echo "Test onchange action"
18
19echo 'hist:keys=comm:newprio=prio:onchange($newprio).save(comm,prio) if comm=="ping"' >> /sys/kernel/debug/tracing/events/sched/sched_waking/trigger
20
21ping $LOCALHOST -c 3
22nice -n 1 ping $LOCALHOST -c 3
23
24if ! grep -q "changed:" events/sched/sched_waking/hist; then
25    fail "Failed to create onchange action inter-event histogram"
26fi
27
28exit 0
29