tools/perf/tests/shell/script_dlfilter.sh
Source file repositories/reference/linux-study-clean/tools/perf/tests/shell/script_dlfilter.sh
File Facts
- System
- Linux kernel
- Corpus path
tools/perf/tests/shell/script_dlfilter.sh- Extension
.sh- Size
- 2385 bytes
- Lines
- 108
- 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
perf/perf_dlfilter.hstring.hstdio.h
Detected Declarations
function filter_eventfunction test_dlfilter
Annotated Snippet
#!/bin/bash
# perf script --dlfilter tests
# SPDX-License-Identifier: GPL-2.0
set -e
shelldir=$(dirname "$0")
# shellcheck source=lib/setup_python.sh
. "${shelldir}"/lib/setup_python.sh
# skip if there's no compiler
if ! [ -x "$(command -v cc)" ]; then
echo "failed: no compiler, install gcc"
exit 2
fi
err=0
perfdata=$(mktemp /tmp/__perf_test.perf.data.XXXXX)
dlfilter_c=$(mktemp /tmp/__perf_test.dlfilter.test.c.XXXXX)
dlfilter_so=$(mktemp /tmp/__perf_test.dlfilter.so.XXXXX)
cleanup() {
rm -f "${perfdata}"
rm -f "${dlfilter_c}"
rm -f "${dlfilter_so}"
rm -f "${dlfilter_so}.o"
trap - EXIT TERM INT
}
trap_cleanup() {
echo "Unexpected signal in ${FUNCNAME[1]}"
cleanup
exit 1
}
trap trap_cleanup EXIT TERM INT
cat <<EOF > "${dlfilter_c}"
#include <perf/perf_dlfilter.h>
#include <string.h>
#include <stdio.h>
struct perf_dlfilter_fns perf_dlfilter_fns;
int filter_event(void *data, const struct perf_dlfilter_sample *sample, void *ctx)
{
const struct perf_dlfilter_al *al;
if (!sample->ip)
return 0;
al = perf_dlfilter_fns.resolve_ip(ctx);
if (!al || !al->sym || strcmp(al->sym, "test_loop"))
return 1;
return 0;
}
EOF
test_dlfilter() {
echo "Basic --dlfilter test"
# Generate perf.data file
if ! perf record -o "${perfdata}" perf test -w thloop 1 2> /dev/null
then
echo "Basic --dlfilter test [Failed record]"
err=1
return
fi
# Build the dlfilter
Annotation
- Immediate include surface: `perf/perf_dlfilter.h`, `string.h`, `stdio.h`.
- Detected declarations: `function filter_event`, `function test_dlfilter`.
- 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.