]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/blame - tools/testing/selftests/ftrace/test.d/ftrace/func_profiler.tc
Merge remote-tracking branches 'asoc/topic/ac97', 'asoc/topic/ac97-mfd', 'asoc/topic...
[mirror_ubuntu-focal-kernel.git] / tools / testing / selftests / ftrace / test.d / ftrace / func_profiler.tc
CommitLineData
c6c93242 1#!/bin/sh
b2441318 2# SPDX-License-Identifier: GPL-2.0
c6c93242
SRRH
3# description: ftrace - function profiler with function tracing
4
5# There was a bug after a rewrite of the ftrace infrastructure that
6# caused the function_profiler not to be able to run with the function
7# tracer, because the function_profiler used the function_graph tracer
8# and it was assumed the two could not run simultaneously.
9#
10# There was another related bug where the solution to the first bug
11# broke the way filtering of the function tracer worked.
12#
13# This test triggers those bugs on those kernels.
14#
15# We need function_graph and profiling to to run this test
16if ! grep -q function_graph available_tracers; then
17 echo "no function graph tracer configured"
18 exit_unsupported;
19fi
20
21if [ ! -f set_ftrace_filter ]; then
22 echo "set_ftrace_filter not found? Is dynamic ftrace not set?"
23 exit_unsupported
24fi
25
26if [ ! -f function_profile_enabled ]; then
27 echo "function_profile_enabled not found, function profiling enabled?"
28 exit_unsupported
29fi
30
31fail() { # mesg
32 reset_tracer
33 echo > set_ftrace_filter
34 echo $1
44164c4b 35 exit $FAIL
c6c93242
SRRH
36}
37
38echo "Testing function tracer with profiler:"
39echo "enable function tracer"
40echo function > current_tracer
41echo "enable profiler"
42echo 1 > function_profile_enabled
43
44sleep 1
45
46echo "Now filter on just schedule"
47echo '*schedule' > set_ftrace_filter
48clear_trace
49
50echo "Now disable function profiler"
51echo 0 > function_profile_enabled
52
53sleep 1
54
55# make sure only schedule functions exist
56
57echo "testing if only schedule is being traced"
58if grep -v -e '^#' -e 'schedule' trace; then
59 fail "more than schedule was found"
60fi
61
62echo "Make sure schedule was traced"
63if ! grep -e 'schedule' trace > /dev/null; then
64 cat trace
65 fail "can not find schedule in trace"
66fi
67
68echo > set_ftrace_filter
69clear_trace
70
71sleep 1
72
73echo "make sure something other than scheduler is being traced"
74if ! grep -v -e '^#' -e 'schedule' trace > /dev/null; then
75 cat trace
76 fail "no other functions besides schedule was found"
77fi
78
79reset_tracer
80
81exit 0