tools/perf/tests/shell/test_task_analyzer.sh
Source file repositories/reference/linux-study-clean/tools/perf/tests/shell/test_task_analyzer.sh
File Facts
- System
- Linux kernel
- Corpus path
tools/perf/tests/shell/test_task_analyzer.sh- Extension
.sh- Size
- 5154 bytes
- Lines
- 183
- 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
function report
Annotated Snippet
#!/bin/bash
# perf script task-analyzer tests (exclusive)
# SPDX-License-Identifier: GPL-2.0
tmpdir=$(mktemp -d /tmp/perf-script-task-analyzer-XXXXX)
# TODO: perf script report only supports input from the CWD perf.data file, make
# it support input from any file.
perfdata="perf.data"
csv="$tmpdir/csv"
csvsummary="$tmpdir/csvsummary"
err=0
# set PERF_EXEC_PATH to find scripts in the source directory
perfdir=$(dirname "$0")/../..
if [ -e "$perfdir/scripts/python/Perf-Trace-Util" ]; then
export PERF_EXEC_PATH=$perfdir
fi
# Disable lsan to avoid warnings about python memory leaks.
export ASAN_OPTIONS=detect_leaks=0
cleanup() {
rm -f "${perfdata}"
rm -f "${perfdata}".old
rm -rf "$tmpdir"
trap - exit term int
}
trap_cleanup() {
cleanup
exit 1
}
trap trap_cleanup exit term int
report() {
if [ "$1" = 0 ]; then
echo "PASS: \"$2\""
else
echo "FAIL: \"$2\" Error message: \"$3\""
err=1
fi
}
check_exec_0() {
if [ $? != 0 ]; then
report 1 "invocation of $1 command failed"
fi
}
find_str_or_fail() {
grep -q "$1" "$2"
if [ "$?" != 0 ]; then
report 1 "$3" "Failed to find required string:'${1}'."
else
report 0 "$3"
fi
}
# check if perf is compiled with libtraceevent support
skip_no_probe_record_support() {
perf check feature -q libtraceevent && return 0
return 2
}
prepare_perf_data() {
# 1s should be sufficient to catch at least some switches
perf record -e sched:sched_switch -a -o "${perfdata}" -- sleep 1 > /dev/null 2>&1
# check if perf data file got created in above step.
if [ ! -e "${perfdata}" ]; then
Annotation
- Detected declarations: `function report`.
- 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.