2 # SPDX-License-Identifier: GPL-2.0
3 # description: event trigger - test multiple histogram triggers
11 if [ ! -f set_event
-o ! -d events
/sched
]; then
12 echo "event tracing is not supported"
16 if [ ! -f events
/sched
/sched_process_fork
/trigger
]; then
17 echo "event trigger is not supported"
21 if [ ! -f events
/sched
/sched_process_fork
/hist
]; then
22 echo "hist trigger is not supported"
26 echo "Test histogram multiple tiggers"
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"
41 echo "Test histogram with its name"
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"
48 echo "Test same named histogram on different events"
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"
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"