1#!/bin/sh 2# description: event tracing - enable/disable with subsystem level files 3# flags: instance 4 5do_reset() { 6 echo > set_event 7 clear_trace 8} 9 10fail() { #msg 11 do_reset 12 echo $1 13 exit $FAIL 14} 15 16yield() { 17 ping localhost -c 1 || sleep .001 || usleep 1 || sleep 1 18} 19 20if [ ! -f set_event -o ! -d events/sched ]; then 21 echo "event tracing is not supported" 22 exit_unsupported 23fi 24 25reset_tracer 26do_reset 27 28echo 'sched:*' > set_event 29 30yield 31 32count=`cat trace | grep -v ^# | awk '{ print $5 }' | sort -u | wc -l` 33if [ $count -lt 3 ]; then 34 fail "at least fork, exec and exit events should be recorded" 35fi 36 37do_reset 38 39echo 1 > events/sched/enable 40 41yield 42 43count=`cat trace | grep -v ^# | awk '{ print $5 }' | sort -u | wc -l` 44if [ $count -lt 3 ]; then 45 fail "at least fork, exec and exit events should be recorded" 46fi 47 48do_reset 49 50echo 0 > events/sched/enable 51 52yield 53 54count=`cat trace | grep -v ^# | awk '{ print $5 }' | sort -u | wc -l` 55if [ $count -ne 0 ]; then 56 fail "any of scheduler events should not be recorded" 57fi 58 59do_reset 60 61exit 0 62