2 # description: ftrace - function profiler with function tracing
4 # There was a bug after a rewrite of the ftrace infrastructure that
5 # caused the function_profiler not to be able to run with the function
6 # tracer, because the function_profiler used the function_graph tracer
7 # and it was assumed the two could not run simultaneously.
9 # There was another related bug where the solution to the first bug
10 # broke the way filtering of the function tracer worked.
12 # This test triggers those bugs on those kernels.
14 # We need function_graph and profiling to to run this test
15 if ! grep -q function_graph available_tracers; then
16 echo "no function graph tracer configured"
20 if [ ! -f set_ftrace_filter ]; then
21 echo "set_ftrace_filter not found? Is dynamic ftrace not set?"
25 if [ ! -f function_profile_enabled ]; then
26 echo "function_profile_enabled not found, function profiling enabled?"
32 echo > set_ftrace_filter
37 echo "Testing function tracer with profiler:"
38 echo "enable function tracer"
39 echo function > current_tracer
40 echo "enable profiler"
41 echo 1 > function_profile_enabled
45 echo "Now filter on just schedule"
46 echo '*schedule' > set_ftrace_filter
49 echo "Now disable function profiler"
50 echo 0 > function_profile_enabled
54 # make sure only schedule functions exist
56 echo "testing if only schedule is being traced"
57 if grep -v -e '^#' -e 'schedule' trace; then
58 fail "more than schedule was found"
61 echo "Make sure schedule was traced"
62 if ! grep -e 'schedule' trace > /dev/null; then
64 fail "can not find schedule in trace"
67 echo > set_ftrace_filter
72 echo "make sure something other than scheduler is being traced"
73 if ! grep -v -e '^#' -e 'schedule' trace > /dev/null; then
75 fail "no other functions besides schedule was found"