Staging
v0.8.1
https://github.com/torvalds/linux
Raw File
Tip revision: 136057256686de39cc3a07c2e39ef6bc43003ff6 authored by Linus Torvalds on 21 November 2021, 21:47:39 UTC
Linux 5.16-rc2
Tip revision: 1360572
fgraph-filter.tc
#!/bin/sh
# SPDX-License-Identifier: GPL-2.0
# description: ftrace - function graph filters
# requires: set_ftrace_filter function_graph:tracer

# Make sure that function graph filtering works

fail() { # msg
    echo $1
    exit_fail
}

disable_tracing
clear_trace

# filter something, schedule is always good
if ! echo "schedule" > set_ftrace_filter; then
    # test for powerpc 64
    if ! echo ".schedule" > set_ftrace_filter; then
	fail "can not enable schedule filter"
    fi
fi

echo function_graph > current_tracer
enable_tracing
sleep 1
# search for functions (has "()" on the line), and make sure
# that only the schedule function was found
count=`cat trace | grep '()' | grep -v schedule | wc -l`
if [ $count -ne 0 ]; then
    fail "Graph filtering not working by itself?"
fi

# Make sure we did find something
count=`cat trace | grep 'schedule()' | wc -l` 
if [ $count -eq 0 ]; then
    fail "No schedule traces found?"
fi

exit 0
back to top