ARM: at91: Replace HTTP links with HTTPS ones
[linux-2.6-microblaze.git] / tools / testing / selftests / ftrace / test.d / trigger / trigger-multihist.tc
1 #!/bin/sh
2 # SPDX-License-Identifier: GPL-2.0
3 # description: event trigger - test multiple histogram triggers
4 # flags: instance
5
6 fail() { #msg
7     echo $1
8     exit_fail
9 }
10
11 if [ ! -f set_event -o ! -d events/sched ]; then
12     echo "event tracing is not supported"
13     exit_unsupported
14 fi
15
16 if [ ! -f events/sched/sched_process_fork/trigger ]; then
17     echo "event trigger is not supported"
18     exit_unsupported
19 fi
20
21 if [ ! -f events/sched/sched_process_fork/hist ]; then
22     echo "hist trigger is not supported"
23     exit_unsupported
24 fi
25
26 echo "Test histogram multiple triggers"
27
28 echo 'hist:keys=parent_pid:vals=child_pid' > events/sched/sched_process_fork/trigger
29 echo 'hist:keys=parent_comm:vals=child_pid' >> events/sched/sched_process_fork/trigger
30 for i in `seq 1 10` ; do ( echo "forked" > /dev/null); done
31 grep parent_pid events/sched/sched_process_fork/hist > /dev/null || \
32     fail "hist trigger on sched_process_fork did not work"
33 grep child events/sched/sched_process_fork/hist > /dev/null || \
34     fail "hist trigger on sched_process_fork did not work"
35 COMM=`cat /proc/$$/comm`
36 grep "parent_comm: $COMM" events/sched/sched_process_fork/hist > /dev/null || \
37     fail "string key on sched_process_fork did not work"
38
39 reset_trigger
40
41 echo "Test histogram with its name"
42
43 echo 'hist:name=test_hist:keys=common_pid' > events/sched/sched_process_fork/trigger
44 for i in `seq 1 10` ; do ( echo "forked" > /dev/null); done
45 grep test_hist events/sched/sched_process_fork/hist > /dev/null || \
46     fail "named event on sched_process_fork did not work"
47
48 echo "Test same named histogram on different events"
49
50 echo 'hist:name=test_hist:keys=common_pid' > events/sched/sched_process_exit/trigger
51 for i in `seq 1 10` ; do ( echo "forked" > /dev/null); done
52 grep test_hist events/sched/sched_process_exit/hist > /dev/null || \
53     fail "named event on sched_process_fork did not work"
54
55 diffs=`diff events/sched/sched_process_exit/hist events/sched/sched_process_fork/hist | wc -l`
56 test $diffs -eq 0 || fail "Same name histograms are not same"
57
58 exit 0