1#!/bin/sh
2# SPDX-License-Identifier: GPL-2.0
3# description: trace_marker trigger - test histogram trigger
4# flags: instance
5
6do_reset() {
7    reset_trigger
8    echo > set_event
9    clear_trace
10}
11
12fail() { #msg
13    do_reset
14    echo $1
15    exit_fail
16}
17
18if [ ! -f set_event ]; then
19    echo "event tracing is not supported"
20    exit_unsupported
21fi
22
23if [ ! -d events/ftrace/print ]; then
24    echo "event trace_marker is not supported"
25    exit_unsupported
26fi
27
28if [ ! -f events/ftrace/print/trigger ]; then
29    echo "event trigger is not supported"
30    exit_unsupported
31fi
32
33if [ ! -f events/ftrace/print/hist ]; then
34    echo "hist trigger is not supported"
35    exit_unsupported
36fi
37
38do_reset
39
40echo "Test histogram trace_marker tigger"
41
42echo 'hist:keys=common_pid' > events/ftrace/print/trigger
43for i in `seq 1 10` ; do echo "hello" > trace_marker; done
44grep 'hitcount: *10$' events/ftrace/print/hist > /dev/null || \
45    fail "hist trigger did not trigger correct times on trace_marker"
46
47do_reset
48
49exit 0
50