aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/tools/testing/selftests/ftrace/test.d/trigger/trigger-trace-marker-hist.tc
blob: 2acbfe2c0c0c4acfd3aafd835b1abe9397de5783 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/bin/sh
# SPDX-License-Identifier: GPL-2.0
# description: trace_marker trigger - test histogram trigger
# flags: instance

do_reset() {
    reset_trigger
    echo > set_event
    clear_trace
}

fail() { #msg
    do_reset
    echo $1
    exit_fail
}

if [ ! -f set_event ]; then
    echo "event tracing is not supported"
    exit_unsupported
fi

if [ ! -d events/ftrace/print ]; then
    echo "event trace_marker is not supported"
    exit_unsupported
fi

if [ ! -f events/ftrace/print/trigger ]; then
    echo "event trigger is not supported"
    exit_unsupported
fi

if [ ! -f events/ftrace/print/hist ]; then
    echo "hist trigger is not supported"
    exit_unsupported
fi

do_reset

echo "Test histogram trace_marker tigger"

echo 'hist:keys=common_pid' > events/ftrace/print/trigger
for i in `seq 1 10` ; do echo "hello" > trace_marker; done
grep 'hitcount: *10$' events/ftrace/print/hist > /dev/null || \
    fail "hist trigger did not trigger correct times on trace_marker"

do_reset

exit 0