tools/testing/selftests/ftrace/test.d/ftrace/func_profiler.tc
Source file repositories/reference/linux-study-clean/tools/testing/selftests/ftrace/test.d/ftrace/func_profiler.tc
File Facts
- System
- Linux kernel
- Corpus path
tools/testing/selftests/ftrace/test.d/ftrace/func_profiler.tc- Extension
.tc- Size
- 1644 bytes
- Lines
- 65
- Domain
- Support Tooling And Documentation
- Bucket
- tools
- Inferred role
- Support Tooling And Documentation: tools
- Status
- atlas-only
Why This File Exists
Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
- Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
Dependency Surface
- No C-style include directives detected by the generator.
Detected Declarations
- No top-level syscall, struct, function, initcall, or export declaration detected by the generator.
Annotated Snippet
#!/bin/sh
# SPDX-License-Identifier: GPL-2.0
# description: ftrace - function profiler with function tracing
# requires: function_profile_enabled set_ftrace_filter function_graph:tracer
# There was a bug after a rewrite of the ftrace infrastructure that
# caused the function_profiler not to be able to run with the function
# tracer, because the function_profiler used the function_graph tracer
# and it was assumed the two could not run simultaneously.
#
# There was another related bug where the solution to the first bug
# broke the way filtering of the function tracer worked.
#
# This test triggers those bugs on those kernels.
#
# We need function_graph and profiling to to run this test
fail() { # mesg
echo $1
exit_fail
}
echo "Testing function tracer with profiler:"
echo "enable function tracer"
echo function > current_tracer
echo "enable profiler"
echo 1 > function_profile_enabled
sleep 1
echo "Now filter on just schedule"
echo '*schedule' > set_ftrace_filter
clear_trace
echo "Now disable function profiler"
echo 0 > function_profile_enabled
sleep 1
# make sure only schedule functions exist
echo "testing if only schedule is being traced"
if grep -v -e '^#' -e 'schedule' trace; then
fail "more than schedule was found"
fi
echo "Make sure schedule was traced"
if ! grep -e 'schedule' trace > /dev/null; then
cat trace
fail "can not find schedule in trace"
fi
echo > set_ftrace_filter
clear_trace
sleep 1
echo "make sure something other than scheduler is being traced"
if ! grep -v -e '^#' -e 'schedule' trace > /dev/null; then
cat trace
fail "no other functions besides schedule was found"
fi
exit 0
Annotation
- Atlas domain: Support Tooling And Documentation / tools.
- Implementation status: atlas-only.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.