1#!/bin/sh 2# description: event trigger - test multiple histogram triggers 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 26if [ ! -f events/sched/sched_process_fork/hist ]; then 27 echo "hist trigger is not supported" 28 exit_unsupported 29fi 30 31reset_tracer 32do_reset 33 34reset_trigger 35 36echo "Test histogram multiple tiggers" 37 38echo 'hist:keys=parent_pid:vals=child_pid' > events/sched/sched_process_fork/trigger 39echo 'hist:keys=parent_comm:vals=child_pid' >> events/sched/sched_process_fork/trigger 40for i in `seq 1 10` ; do ( echo "forked" > /dev/null); done 41grep parent_pid events/sched/sched_process_fork/hist > /dev/null || \ 42 fail "hist trigger on sched_process_fork did not work" 43grep child events/sched/sched_process_fork/hist > /dev/null || \ 44 fail "hist trigger on sched_process_fork did not work" 45COMM=`cat /proc/$$/comm` 46grep "parent_comm: $COMM" events/sched/sched_process_fork/hist > /dev/null || \ 47 fail "string key on sched_process_fork did not work" 48 49reset_trigger 50 51echo "Test histogram with its name" 52 53echo 'hist:name=test_hist:keys=common_pid' > events/sched/sched_process_fork/trigger 54for i in `seq 1 10` ; do ( echo "forked" > /dev/null); done 55grep test_hist events/sched/sched_process_fork/hist > /dev/null || \ 56 fail "named event on sched_process_fork did not work" 57 58echo "Test same named histogram on different events" 59 60echo 'hist:name=test_hist:keys=common_pid' > events/sched/sched_process_exit/trigger 61for i in `seq 1 10` ; do ( echo "forked" > /dev/null); done 62grep test_hist events/sched/sched_process_exit/hist > /dev/null || \ 63 fail "named event on sched_process_fork did not work" 64 65diffs=`diff events/sched/sched_process_exit/hist events/sched/sched_process_fork/hist | wc -l` 66test $diffs -eq 0 || fail "Same name histograms are not same" 67 68reset_trigger 69 70do_reset 71 72exit 0 73