1*f1aab363SSteven Rostedt (Google)#!/bin/sh
2*f1aab363SSteven Rostedt (Google)# SPDX-License-Identifier: GPL-2.0
3*f1aab363SSteven Rostedt (Google)# description: event trigger - test inter-event histogram trigger trace action with dynamic string param (legacy stack)
4*f1aab363SSteven Rostedt (Google)# requires: set_event synthetic_events events/sched/sched_process_exec/hist "long[] stack' >> synthetic_events":README
5*f1aab363SSteven Rostedt (Google)
6*f1aab363SSteven Rostedt (Google)fail() { #msg
7*f1aab363SSteven Rostedt (Google)    echo $1
8*f1aab363SSteven Rostedt (Google)    exit_fail
9*f1aab363SSteven Rostedt (Google)}
10*f1aab363SSteven Rostedt (Google)
11*f1aab363SSteven Rostedt (Google)echo "Test create synthetic event with stack"
12*f1aab363SSteven Rostedt (Google)
13*f1aab363SSteven Rostedt (Google)# Test the old stacktrace keyword (for backward compatibility)
14*f1aab363SSteven Rostedt (Google)echo 's:wake_lat pid_t pid; u64 delta; unsigned long[] stack;' > dynamic_events
15*f1aab363SSteven Rostedt (Google)echo 'hist:keys=next_pid:ts=common_timestamp.usecs,st=stacktrace  if prev_state == 1||prev_state == 2' >> events/sched/sched_switch/trigger
16*f1aab363SSteven Rostedt (Google)echo 'hist:keys=prev_pid:delta=common_timestamp.usecs-$ts,s=$st:onmax($delta).trace(wake_lat,prev_pid,$delta,$s)' >> events/sched/sched_switch/trigger
17*f1aab363SSteven Rostedt (Google)echo 1 > events/synthetic/wake_lat/enable
18*f1aab363SSteven Rostedt (Google)sleep 1
19*f1aab363SSteven Rostedt (Google)
20*f1aab363SSteven Rostedt (Google)if ! grep -q "=>.*sched" trace; then
21*f1aab363SSteven Rostedt (Google)    fail "Failed to create synthetic event with stack"
22*f1aab363SSteven Rostedt (Google)fi
23*f1aab363SSteven Rostedt (Google)
24*f1aab363SSteven Rostedt (Google)exit 0
25