1#!/bin/sh 2# SPDX-License-Identifier: GPL-2.0 3# description: event trigger - test inter-event histogram trigger snapshot 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 15if [ ! -f snapshot ]; then 16 echo "snapshot is not supported" 17 exit_unsupported 18fi 19 20grep -q "onchange(var)" README || exit_unsupported # version issue 21 22grep -q "snapshot()" README || exit_unsupported # version issue 23 24echo "Test snapshot action" 25 26echo 1 > /sys/kernel/debug/tracing/events/sched/enable 27 28echo 'hist:keys=comm:newprio=prio:onchange($newprio).save(comm,prio):onchange($newprio).snapshot() if comm=="ping"' >> /sys/kernel/debug/tracing/events/sched/sched_waking/trigger 29 30ping $LOCALHOST -c 3 31nice -n 1 ping $LOCALHOST -c 3 32 33echo 0 > tracing_on 34 35if ! grep -q "changed:" events/sched/sched_waking/hist; then 36 fail "Failed to create onchange action inter-event histogram" 37fi 38 39if ! grep -q "comm=ping" snapshot; then 40 fail "Failed to create snapshot action inter-event histogram" 41fi 42 43exit 0 44