^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) #!/bin/sh
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) # SPDX-License-Identifier: GPL-2.0-only
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) usage() {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) echo "Dump boot-time tracing bootconfig from ftrace"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) echo "Usage: $0 [--debug] [ > BOOTCONFIG-FILE]"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) exit 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) DEBUG=
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) while [ x"$1" != x ]; do
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) case "$1" in
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) "--debug")
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) DEBUG=$1;;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) -*)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) usage
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) ;;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) esac
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) shift 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) done
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) if [ x"$DEBUG" != x ]; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) set -x
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) fi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) TRACEFS=`grep -m 1 -w tracefs /proc/mounts | cut -f 2 -d " "`
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) if [ -z "$TRACEFS" ]; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) if ! grep -wq debugfs /proc/mounts; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) echo "Error: No tracefs/debugfs was mounted."
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) exit 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) fi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) TRACEFS=`grep -m 1 -w debugfs /proc/mounts | cut -f 2 -d " "`/tracing
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) if [ ! -d $TRACEFS ]; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) echo "Error: ftrace is not enabled on this kernel." 1>&2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) exit 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) fi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) fi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) ######## main #########
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) set -e
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) emit_kv() { # key =|+= value
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) echo "$@"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) global_options() {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) val=`cat $TRACEFS/max_graph_depth`
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) [ $val != 0 ] && emit_kv kernel.fgraph_max_depth = $val
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) if grep -qv "^#" $TRACEFS/set_graph_function $TRACEFS/set_graph_notrace ; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) cat 1>&2 << EOF
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) # WARN: kernel.fgraph_filters and kernel.fgraph_notrace are not supported, since the wild card expression was expanded and lost from memory.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) EOF
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) fi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) kprobe_event_options() {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) cat $TRACEFS/kprobe_events | while read p args; do
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) case $p in
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) r*)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) cat 1>&2 << EOF
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) # WARN: A return probe found but it is not supported by bootconfig. Skip it.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) EOF
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) continue;;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) esac
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) p=${p#*:}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) event=${p#*/}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) group=${p%/*}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) if [ $group != "kprobes" ]; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) cat 1>&2 << EOF
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) # WARN: kprobes group name $group is changed to "kprobes" for bootconfig.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) EOF
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) fi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) emit_kv $PREFIX.event.kprobes.$event.probes += $args
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) done
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) synth_event_options() {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) cat $TRACEFS/synthetic_events | while read event fields; do
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) emit_kv $PREFIX.event.synthetic.$event.fields = `echo $fields | sed "s/;/,/g"`
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) done
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) # Variables resolver
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) DEFINED_VARS=
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) UNRESOLVED_EVENTS=
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) defined_vars() { # event-dir
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) grep "^hist" $1/trigger | grep -o ':[a-zA-Z0-9]*='
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91) referred_vars() {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) grep "^hist" $1/trigger | grep -o '$[a-zA-Z0-9]*'
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95) per_event_options() { # event-dir
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96) evdir=$1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97) # Check the special event which has no filter and no trigger
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98) [ ! -f $evdir/filter ] && return
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) if grep -q "^hist:" $evdir/trigger; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) # hist action can refer the undefined variables
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) __vars=`defined_vars $evdir`
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) for v in `referred_vars $evdir`; do
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) if echo $DEFINED_VARS $__vars | grep -vqw ${v#$}; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) # $v is not defined yet, defer it
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) UNRESOLVED_EVENTS="$UNRESOLVED_EVENTS $evdir"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) return;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) fi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) done
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) DEFINED_VARS="$DEFINED_VARS "`defined_vars $evdir`
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) fi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) grep -v "^#" $evdir/trigger | while read action active; do
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) emit_kv $PREFIX.event.$group.$event.actions += \'$action\'
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) done
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) # enable is not checked; this is done by set_event in the instance.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) val=`cat $evdir/filter`
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) if [ "$val" != "none" ]; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) emit_kv $PREFIX.event.$group.$event.filter = "$val"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) fi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) retry_unresolved() {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) unresolved=$UNRESOLVED_EVENTS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) UNRESOLVED_EVENTS=
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) for evdir in $unresolved; do
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) event=${evdir##*/}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) group=${evdir%/*}; group=${group##*/}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) per_event_options $evdir
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) done
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) event_options() {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) # PREFIX and INSTANCE must be set
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) if [ $PREFIX = "ftrace" ]; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) # define the dynamic events
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) kprobe_event_options
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) synth_event_options
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) fi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) for group in `ls $INSTANCE/events/` ; do
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) [ ! -d $INSTANCE/events/$group ] && continue
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) for event in `ls $INSTANCE/events/$group/` ;do
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) [ ! -d $INSTANCE/events/$group/$event ] && continue
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) per_event_options $INSTANCE/events/$group/$event
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) done
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) done
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) retry=0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) while [ $retry -lt 3 ]; do
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) retry_unresolved
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) retry=$((retry + 1))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) done
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) if [ "$UNRESOLVED_EVENTS" ]; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) cat 1>&2 << EOF
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) ! ERROR: hist triggers in $UNRESOLVED_EVENTS use some undefined variables.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) EOF
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) fi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) is_default_trace_option() { # option
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) grep -qw $1 << EOF
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) print-parent
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) nosym-offset
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) nosym-addr
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) noverbose
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) noraw
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) nohex
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) nobin
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) noblock
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) trace_printk
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) annotate
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) nouserstacktrace
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) nosym-userobj
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) noprintk-msg-only
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) context-info
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) nolatency-format
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) record-cmd
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) norecord-tgid
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) overwrite
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) nodisable_on_free
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) irq-info
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) markers
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) noevent-fork
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) nopause-on-trace
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) function-trace
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) nofunction-fork
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) nodisplay-graph
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) nostacktrace
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) notest_nop_accept
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) notest_nop_refuse
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) EOF
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) instance_options() { # [instance-name]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) if [ $# -eq 0 ]; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) PREFIX="ftrace"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) INSTANCE=$TRACEFS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) PREFIX="ftrace.instance.$1"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) INSTANCE=$TRACEFS/instances/$1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) fi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) val=
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) for i in `cat $INSTANCE/trace_options`; do
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) is_default_trace_option $i && continue
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) val="$val, $i"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) done
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) [ "$val" ] && emit_kv $PREFIX.options = "${val#,}"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) val="local"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) for i in `cat $INSTANCE/trace_clock` ; do
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) [ "${i#*]}" ] && continue
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) i=${i%]}; val=${i#[}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) done
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) [ $val != "local" ] && emit_kv $PREFIX.trace_clock = $val
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) val=`cat $INSTANCE/buffer_size_kb`
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) if echo $val | grep -vq "expanded" ; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) emit_kv $PREFIX.buffer_size = $val"KB"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) fi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) if grep -q "is allocated" $INSTANCE/snapshot ; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) emit_kv $PREFIX.alloc_snapshot
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) fi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) val=`cat $INSTANCE/tracing_cpumask`
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) if [ `echo $val | sed -e s/f//g`x != x ]; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) emit_kv $PREFIX.cpumask = $val
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) fi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) val=`cat $INSTANCE/tracing_on`
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) if [ "$val" = "0" ]; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) emit_kv $PREFIX.tracing_on = 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) fi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) val=
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) for i in `cat $INSTANCE/set_event`; do
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) val="$val, $i"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) done
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) [ "$val" ] && emit_kv $PREFIX.events = "${val#,}"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) val=`cat $INSTANCE/current_tracer`
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) [ $val != nop ] && emit_kv $PREFIX.tracer = $val
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) if grep -qv "^#" $INSTANCE/set_ftrace_filter $INSTANCE/set_ftrace_notrace; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) cat 1>&2 << EOF
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) # WARN: kernel.ftrace.filters and kernel.ftrace.notrace are not supported, since the wild card expression was expanded and lost from memory.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) EOF
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) fi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) event_options
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) global_options
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) instance_options
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246) for i in `ls $TRACEFS/instances` ; do
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247) instance_options $i
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248) done