staging: rtl8192u: remove redundant assignment to pointer crypt
[linux/fpc-iii.git] / tools / testing / selftests / ftrace / test.d / trigger / trigger-hist.tc
blob177e8d4c474419f0f43b83dfd48829dc1436c7ba
1 #!/bin/sh
2 # SPDX-License-Identifier: GPL-2.0
3 # description: event trigger - test histogram trigger
4 # flags: instance
6 fail() { #msg
7 echo $1
8 exit_fail
11 if [ ! -f set_event -o ! -d events/sched ]; then
12 echo "event tracing is not supported"
13 exit_unsupported
16 if [ ! -f events/sched/sched_process_fork/trigger ]; then
17 echo "event trigger is not supported"
18 exit_unsupported
21 if [ ! -f events/sched/sched_process_fork/hist ]; then
22 echo "hist trigger is not supported"
23 exit_unsupported
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"
35 reset_trigger
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"
44 reset_trigger
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"
54 reset_trigger
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
61 check_inc() {
62 while [ $# -gt 1 ]; do
63 [ $1 -gt $2 ] && return 1
64 shift 1
65 done
66 return 0
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"
72 exit 0