tools/perf/tests/shell/data_type_profiling.sh
Source file repositories/reference/linux-study-clean/tools/perf/tests/shell/data_type_profiling.sh
File Facts
- System
- Linux kernel
- Corpus path
tools/perf/tests/shell/data_type_profiling.sh- Extension
.sh- Size
- 2190 bytes
- Lines
- 94
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
- No C-style include directives detected by the generator.
Detected Declarations
function test_basic_annotate
Annotated Snippet
#!/bin/bash
# perf data type profiling tests
# SPDX-License-Identifier: GPL-2.0
set -e
# The logic below follows the same line as the annotate test, but looks for a
# data type profiling manifestation
# Values in testtypes and testprogs should match
testtypes=("# data-type: struct Buf" "# data-type: struct buf")
testprogs=("perf test -w code_with_type" "perf test -w datasym")
err=0
perfdata=$(mktemp /tmp/__perf_test.perf.data.XXXXX)
perfout=$(mktemp /tmp/__perf_test.perf.out.XXXXX)
# Check for support of perf mem before trap handler
perf mem record -o /dev/null -- true 2>&1 | \
grep -q "failed: no PMU supports the memory events" && exit 2
cleanup() {
rm -rf "${perfdata}" "${perfout}"
rm -rf "${perfdata}".old
trap - EXIT TERM INT
}
trap_cleanup() {
echo "Unexpected signal in ${FUNCNAME[1]}"
cleanup
exit 1
}
trap trap_cleanup EXIT TERM INT
test_basic_annotate() {
mode=$1
runtime=$2
echo "${mode} ${runtime} perf annotate test"
case "x${runtime}" in
"xRust")
if ! perf check feature -q rust
then
echo "Skip: code_with_type workload not built in 'perf test'"
return
fi
index=0 ;;
"xC")
index=1 ;;
esac
if [ "x${mode}" == "xBasic" ]
then
perf mem record -o "${perfdata}" ${testprogs[$index]} 2> /dev/null
else
perf mem record -o - ${testprogs[$index]} 2> /dev/null > "${perfdata}"
fi
if [ "x$?" != "x0" ]
then
echo "${mode} annotate [Failed: perf record]"
err=1
return
fi
# Generate the annotated output file
if [ "x${mode}" == "xBasic" ]
then
Annotation
- Detected declarations: `function test_basic_annotate`.
- 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.