1#!/bin/sh 2# SPDX-License-Identifier: GPL-2.0 3# description: event tracing - enable/disable with subsystem level files 4# flags: instance 5 6do_reset() { 7 echo > set_event 8 clear_trace 9} 10 11fail() { #msg 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 21echo 'sched:*' > set_event 22 23yield 24 25count=`cat trace | grep -v ^# | awk '{ print $5 }' | sort -u | wc -l` 26if [ $count -lt 3 ]; then 27 fail "at least fork, exec and exit events should be recorded" 28fi 29 30do_reset 31 32echo 1 > events/sched/enable 33 34yield 35 36count=`cat trace | grep -v ^# | awk '{ print $5 }' | sort -u | wc -l` 37if [ $count -lt 3 ]; then 38 fail "at least fork, exec and exit events should be recorded" 39fi 40 41do_reset 42 43echo 0 > events/sched/enable 44 45yield 46 47count=`cat trace | grep -v ^# | awk '{ print $5 }' | sort -u | wc -l` 48if [ $count -ne 0 ]; then 49 fail "any of scheduler events should not be recorded" 50fi 51 52exit 0 53