Commit | Line | Data |
---|---|---|
76929ab5 MH |
1 | #!/bin/sh |
2 | # description: event trigger - test histogram modifiers | |
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 | ||
0ded5174 | 26 | if [ ! -f events/sched/sched_process_fork/hist ]; then |
76929ab5 MH |
27 | echo "hist trigger is not supported" |
28 | exit_unsupported | |
29 | fi | |
30 | ||
0ded5174 SRRH |
31 | reset_tracer |
32 | do_reset | |
33 | ||
76929ab5 MH |
34 | echo "Test histogram with execname modifier" |
35 | ||
36 | echo 'hist:keys=common_pid.execname' > events/sched/sched_process_fork/trigger | |
37 | for i in `seq 1 10` ; do ( echo "forked" > /dev/null); done | |
38 | COMM=`cat /proc/$$/comm` | |
39 | grep "common_pid: $COMM" events/sched/sched_process_fork/hist > /dev/null || \ | |
40 | fail "execname modifier on sched_process_fork did not work" | |
41 | ||
42 | reset_trigger | |
43 | ||
44 | echo "Test histogram with hex modifier" | |
45 | ||
46 | echo 'hist:keys=parent_pid.hex' > events/sched/sched_process_fork/trigger | |
47 | for i in `seq 1 10` ; do ( echo "forked" > /dev/null); done | |
48 | # Note that $$ is the parent pid. $PID is current PID. | |
49 | HEX=`printf %x $PID` | |
50 | grep "parent_pid: $HEX" events/sched/sched_process_fork/hist > /dev/null || \ | |
51 | fail "hex modifier on sched_process_fork did not work" | |
52 | ||
53 | reset_trigger | |
54 | ||
55 | echo "Test histogram with syscall modifier" | |
56 | ||
57 | echo 'hist:keys=id.syscall' > events/raw_syscalls/sys_exit/trigger | |
58 | for i in `seq 1 10` ; do ( echo "forked" > /dev/null); done | |
59 | grep "id: sys_" events/raw_syscalls/sys_exit/hist > /dev/null || \ | |
60 | fail "syscall modifier on raw_syscalls/sys_exit did not work" | |
61 | ||
93c5f671 MH |
62 | |
63 | reset_trigger | |
64 | ||
65 | echo "Test histgram with log2 modifier" | |
66 | ||
67 | echo 'hist:keys=bytes_req.log2' > events/kmem/kmalloc/trigger | |
68 | for i in `seq 1 10` ; do ( echo "forked" > /dev/null); done | |
69 | grep 'bytes_req: ~ 2^[0-9]*' events/kmem/kmalloc/hist > /dev/null || \ | |
70 | fail "log2 modifier on kmem/kmalloc did not work" | |
71 | ||
76929ab5 MH |
72 | do_reset |
73 | ||
74 | exit 0 |