1#!/bin/sh
2# SPDX-License-Identifier: GPL-2.0
3# description: event trigger - test multiple actions on hist trigger
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 synthetic_events ]; then
16    echo "synthetic event is not supported"
17    exit_unsupported
18fi
19
20if [ ! -f events/sched/sched_process_fork/hist ]; then
21    echo "hist trigger is not supported"
22    exit_unsupported
23fi
24
25echo "Test multiple actions on hist trigger"
26echo 'wakeup_latency u64 lat; pid_t pid' >> synthetic_events
27TRIGGER1=events/sched/sched_wakeup/trigger
28TRIGGER2=events/sched/sched_switch/trigger
29
30echo 'hist:keys=pid:ts0=common_timestamp.usecs if comm=="cyclictest"' > $TRIGGER1
31echo 'hist:keys=next_pid:wakeup_lat=common_timestamp.usecs-$ts0 if next_comm=="cyclictest"' >> $TRIGGER2
32echo 'hist:keys=next_pid:onmatch(sched.sched_wakeup).wakeup_latency(sched.sched_switch.$wakeup_lat,next_pid) if next_comm=="cyclictest"' >> $TRIGGER2
33echo 'hist:keys=next_pid:onmatch(sched.sched_wakeup).wakeup_latency(sched.sched_switch.$wakeup_lat,prev_pid) if next_comm=="cyclictest"' >> $TRIGGER2
34echo 'hist:keys=next_pid if next_comm=="cyclictest"' >> $TRIGGER2
35
36exit 0
37