]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blame - tools/testing/selftests/ftrace/test.d/trigger/trigger-hist-mod.tc
Merge tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost
[mirror_ubuntu-artful-kernel.git] / tools / testing / selftests / ftrace / test.d / trigger / trigger-hist-mod.tc
CommitLineData
76929ab5
MH
1#!/bin/sh
2# description: event trigger - test histogram modifiers
3
4do_reset() {
5 reset_trigger
6 echo > set_event
7 clear_trace
8}
9
10fail() { #msg
11 do_reset
12 echo $1
13 exit $FAIL
14}
15
16if [ ! -f set_event -o ! -d events/sched ]; then
17 echo "event tracing is not supported"
18 exit_unsupported
19fi
20
21if [ ! -f events/sched/sched_process_fork/trigger ]; then
22 echo "event trigger is not supported"
23 exit_unsupported
24fi
25
0ded5174 26if [ ! -f events/sched/sched_process_fork/hist ]; then
76929ab5
MH
27 echo "hist trigger is not supported"
28 exit_unsupported
29fi
30
0ded5174
SRRH
31reset_tracer
32do_reset
33
76929ab5
MH
34echo "Test histogram with execname modifier"
35
36echo 'hist:keys=common_pid.execname' > events/sched/sched_process_fork/trigger
37for i in `seq 1 10` ; do ( echo "forked" > /dev/null); done
38COMM=`cat /proc/$$/comm`
39grep "common_pid: $COMM" events/sched/sched_process_fork/hist > /dev/null || \
40 fail "execname modifier on sched_process_fork did not work"
41
42reset_trigger
43
44echo "Test histogram with hex modifier"
45
46echo 'hist:keys=parent_pid.hex' > events/sched/sched_process_fork/trigger
47for i in `seq 1 10` ; do ( echo "forked" > /dev/null); done
48# Note that $$ is the parent pid. $PID is current PID.
49HEX=`printf %x $PID`
50grep "parent_pid: $HEX" events/sched/sched_process_fork/hist > /dev/null || \
51 fail "hex modifier on sched_process_fork did not work"
52
53reset_trigger
54
55echo "Test histogram with syscall modifier"
56
57echo 'hist:keys=id.syscall' > events/raw_syscalls/sys_exit/trigger
58for i in `seq 1 10` ; do ( echo "forked" > /dev/null); done
780ade55 59grep "id: \(unknown_\|sys_\)" events/raw_syscalls/sys_exit/hist > /dev/null || \
76929ab5
MH
60 fail "syscall modifier on raw_syscalls/sys_exit did not work"
61
93c5f671
MH
62
63reset_trigger
64
65echo "Test histgram with log2 modifier"
66
67echo 'hist:keys=bytes_req.log2' > events/kmem/kmalloc/trigger
68for i in `seq 1 10` ; do ( echo "forked" > /dev/null); done
69grep 'bytes_req: ~ 2^[0-9]*' events/kmem/kmalloc/hist > /dev/null || \
70 fail "log2 modifier on kmem/kmalloc did not work"
71
76929ab5
MH
72do_reset
73
74exit 0