xref: /linux/tools/testing/selftests/ftrace/test.d/trigger/inter-event/trigger-synthetic-event-stack.tc (revision 6e7fd890f1d6ac83805409e9c346240de2705584)
1#!/bin/sh
2# SPDX-License-Identifier: GPL-2.0
3# description: event trigger - test inter-event histogram trigger trace action with dynamic string param
4# requires: set_event synthetic_events events/sched/sched_process_exec/hist "can be any field, or the special string 'common_stacktrace'":README
5
6fail() { #msg
7    echo $1
8    exit_fail
9}
10
11echo "Test create synthetic event with stack"
12
13echo 's:wake_lat pid_t pid; u64 delta; unsigned long[] stack;' > dynamic_events
14echo 'hist:keys=next_pid:ts=common_timestamp.usecs,st=common_stacktrace  if prev_state == 1||prev_state == 2' >> events/sched/sched_switch/trigger
15echo '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
16echo 1 > events/synthetic/wake_lat/enable
17sleep 1
18
19if ! grep -q "=>.*sched" trace; then
20    fail "Failed to create synthetic event with stack"
21fi
22
23exit 0
24