xref: /linux/tools/testing/selftests/ftrace/test.d/trigger/inter-event/trigger-snapshot-action-hist.tc (revision 7ae9fb1b7ecbb5d85d07857943f677fd1a559b18)
1146459feSTom Zanussi#!/bin/sh
2146459feSTom Zanussi# SPDX-License-Identifier: GPL-2.0
3146459feSTom Zanussi# description: event trigger - test inter-event histogram trigger snapshot action
4*4aa4d4deSNaveen N. Rao# requires: set_event snapshot events/sched/sched_process_fork/hist "onchange(var)":README "snapshot()":README ping:program
5146459feSTom Zanussi
6146459feSTom Zanussifail() { #msg
7146459feSTom Zanussi    echo $1
8146459feSTom Zanussi    exit_fail
9146459feSTom Zanussi}
10146459feSTom Zanussi
11146459feSTom Zanussiecho "Test snapshot action"
12146459feSTom Zanussi
13ba1b9c50SMasami Hiramatsuecho 1 > events/sched/enable
14146459feSTom Zanussi
15ba1b9c50SMasami Hiramatsuecho 'hist:keys=comm:newprio=prio:onchange($newprio).save(comm,prio):onchange($newprio).snapshot() if comm=="ping"' >> events/sched/sched_waking/trigger
16146459feSTom Zanussi
17146459feSTom Zanussiping $LOCALHOST -c 3
18146459feSTom Zanussinice -n 1 ping $LOCALHOST -c 3
19146459feSTom Zanussi
20146459feSTom Zanussiecho 0 > tracing_on
21146459feSTom Zanussi
22146459feSTom Zanussiif ! grep -q "changed:" events/sched/sched_waking/hist; then
23146459feSTom Zanussi    fail "Failed to create onchange action inter-event histogram"
24146459feSTom Zanussifi
25146459feSTom Zanussi
26146459feSTom Zanussiif ! grep -q "comm=ping" snapshot; then
27146459feSTom Zanussi    fail "Failed to create snapshot action inter-event histogram"
28146459feSTom Zanussifi
29146459feSTom Zanussi
30146459feSTom Zanussiexit 0
31