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