Merge branch 'fixes' of git://git.armlinux.org.uk/~rmk/linux-arm
[deliverable/linux.git] / tools / testing / selftests / ftrace / test.d / trigger / trigger-hist.tc
1 #!/bin/sh
2 # description: event trigger - test histogram trigger
3
4 do_reset() {
5 reset_trigger
6 echo > set_event
7 clear_trace
8 }
9
10 fail() { #msg
11 do_reset
12 echo $1
13 exit $FAIL
14 }
15
16 if [ ! -f set_event -o ! -d events/sched ]; then
17 echo "event tracing is not supported"
18 exit_unsupported
19 fi
20
21 if [ ! -f events/sched/sched_process_fork/trigger ]; then
22 echo "event trigger is not supported"
23 exit_unsupported
24 fi
25
26 reset_tracer
27 do_reset
28
29 FEATURE=`grep hist events/sched/sched_process_fork/trigger`
30 if [ -z "$FEATURE" ]; then
31 echo "hist trigger is not supported"
32 exit_unsupported
33 fi
34
35 echo "Test histogram basic tigger"
36
37 echo 'hist:keys=parent_pid:vals=child_pid' > events/sched/sched_process_fork/trigger
38 for i in `seq 1 10` ; do ( echo "forked" > /dev/null); done
39 grep parent_pid events/sched/sched_process_fork/hist > /dev/null || \
40 fail "hist trigger on sched_process_fork did not work"
41 grep child events/sched/sched_process_fork/hist > /dev/null || \
42 fail "hist trigger on sched_process_fork did not work"
43
44 reset_trigger
45
46 echo "Test histogram with compound keys"
47
48 echo 'hist:keys=parent_pid,child_pid' > events/sched/sched_process_fork/trigger
49 for i in `seq 1 10` ; do ( echo "forked" > /dev/null); done
50 grep '^{ parent_pid:.*, child_pid:.*}' events/sched/sched_process_fork/hist > /dev/null || \
51 fail "compound keys on sched_process_fork did not work"
52
53 reset_trigger
54
55 echo "Test histogram with string key"
56
57 echo 'hist:keys=parent_comm' > events/sched/sched_process_fork/trigger
58 for i in `seq 1 10` ; do ( echo "forked" > /dev/null); done
59 COMM=`cat /proc/$$/comm`
60 grep "parent_comm: $COMM" events/sched/sched_process_fork/hist > /dev/null || \
61 fail "string key on sched_process_fork did not work"
62
63 reset_trigger
64
65 echo "Test histogram with sort key"
66
67 echo 'hist:keys=parent_pid,child_pid:sort=child_pid.ascending' > events/sched/sched_process_fork/trigger
68 for i in `seq 1 10` ; do ( echo "forked" > /dev/null); done
69
70 check_inc() {
71 while [ $# -gt 1 ]; do
72 [ $1 -gt $2 ] && return 1
73 shift 1
74 done
75 return 0
76 }
77 check_inc `grep -o "child_pid:[[:space:]]*[[:digit:]]*" \
78 events/sched/sched_process_fork/hist | cut -d: -f2 ` ||
79 fail "sort param on sched_process_fork did not work"
80
81 do_reset
82
83 exit 0
This page took 0.034034 seconds and 6 git commands to generate.