2 # SPDX-License-Identifier: GPL-2.0
3 # description: event trigger - test histogram trigger
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 basic tigger"
28 echo 'hist:keys=parent_pid:vals=child_pid' > events
/sched
/sched_process_fork
/trigger
29 for i
in `seq 1 10` ; do ( echo "forked" > /dev
/null
); done
30 grep parent_pid events
/sched
/sched_process_fork
/hist
> /dev
/null || \
31 fail
"hist trigger on sched_process_fork did not work"
32 grep child events
/sched
/sched_process_fork
/hist
> /dev
/null || \
33 fail
"hist trigger on sched_process_fork did not work"
37 echo "Test histogram with compound keys"
39 echo 'hist:keys=parent_pid,child_pid' > events
/sched
/sched_process_fork
/trigger
40 for i
in `seq 1 10` ; do ( echo "forked" > /dev
/null
); done
41 grep '^{ parent_pid:.*, child_pid:.*}' events
/sched
/sched_process_fork
/hist
> /dev
/null || \
42 fail
"compound keys on sched_process_fork did not work"
46 echo "Test histogram with string key"
48 echo 'hist:keys=parent_comm' > events
/sched
/sched_process_fork
/trigger
49 for i
in `seq 1 10` ; do ( echo "forked" > /dev
/null
); done
50 COMM
=`cat /proc/$$/comm`
51 grep "parent_comm: $COMM" events
/sched
/sched_process_fork
/hist
> /dev
/null || \
52 fail
"string key on sched_process_fork did not work"
56 echo "Test histogram with sort key"
58 echo 'hist:keys=parent_pid,child_pid:sort=child_pid.ascending' > events
/sched
/sched_process_fork
/trigger
59 for i
in `seq 1 10` ; do ( echo "forked" > /dev
/null
); done
62 while [ $# -gt 1 ]; do
63 [ $1 -gt $2 ] && return 1
68 check_inc
`grep -o "child_pid:[[:space:]]*[[:digit:]]*" \
69 events/sched/sched_process_fork/hist | cut -d: -f2 ` ||
70 fail
"sort param on sched_process_fork did not work"