tools/perf/tests/shell/header.sh
Source file repositories/reference/linux-study-clean/tools/perf/tests/shell/header.sh
File Facts
- System
- Linux kernel
- Corpus path
tools/perf/tests/shell/header.sh- Extension
.sh- Size
- 1343 bytes
- Lines
- 75
- 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 check_header_output
Annotated Snippet
#!/bin/bash
# perf header tests
# SPDX-License-Identifier: GPL-2.0
set -e
err=0
perfdata=$(mktemp /tmp/__perf_test_header.perf.data.XXXXX)
script_output=$(mktemp /tmp/__perf_test_header.perf.data.XXXXX.script)
cleanup() {
rm -f "${perfdata}"
rm -f "${perfdata}".old
rm -f "${script_output}"
trap - EXIT TERM INT
}
trap_cleanup() {
echo "Unexpected signal in ${FUNCNAME[1]}"
cleanup
exit 1
}
trap trap_cleanup EXIT TERM INT
check_header_output() {
declare -a fields=(
"captured"
"hostname"
"os release"
"arch"
"cpuid"
"nrcpus"
"event"
"cmdline"
"perf version"
"sibling (cores|dies|threads)"
"sibling threads"
"total memory"
)
for i in "${fields[@]}"
do
if ! grep -q -E "$i" "${script_output}"
then
echo "Failed to find expected $i in output"
err=1
fi
done
}
test_file() {
echo "Test perf header file"
perf record -o "${perfdata}" -- perf test -w noploop
perf report --header-only -I -i "${perfdata}" > "${script_output}"
check_header_output
echo "Test perf header file [Done]"
}
test_pipe() {
echo "Test perf header pipe"
perf record -o - -- perf test -w noploop | perf report --header-only -I -i - > "${script_output}"
check_header_output
echo "Test perf header pipe [Done]"
}
test_file
Annotation
- Detected declarations: `function check_header_output`.
- 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.