tools/perf/tests/sample-parsing.c
Source file repositories/reference/linux-study-clean/tools/perf/tests/sample-parsing.c
File Facts
- System
- Linux kernel
- Corpus path
tools/perf/tests/sample-parsing.c- Extension
.c- Size
- 11546 bytes
- Lines
- 461
- Domain
- Support Tooling And Documentation
- Bucket
- tools
- Inferred role
- Support Tooling And Documentation: implementation source
- Status
- source implementation candidate
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
stdbool.hinttypes.hstdlib.hstring.hlinux/bitops.hlinux/kernel.hlinux/types.hmap_symbol.hbranch.hevent.hevsel.hdebug.hutil/synthetic-events.hutil/util.htests.h
Detected Declarations
function valuefunction do_testfunction test__sample_parsing
Annotated Snippet
if (read_format & PERF_FORMAT_GROUP) {
for (i = 0; i < s1->read.group.nr; i++) {
/* FIXME: check values without LOST */
if (read_format & PERF_FORMAT_LOST)
MCOMP(read.group.values[i]);
}
} else {
COMP(read.one.id);
if (read_format & PERF_FORMAT_LOST)
COMP(read.one.lost);
}
}
if (type & PERF_SAMPLE_CALLCHAIN) {
COMP(callchain->nr);
for (i = 0; i < s1->callchain->nr; i++)
COMP(callchain->ips[i]);
}
if (type & PERF_SAMPLE_RAW) {
COMP(raw_size);
if (memcmp(s1->raw_data, s2->raw_data, s1->raw_size)) {
pr_debug("Samples differ at 'raw_data'\n");
return false;
}
}
if (type & PERF_SAMPLE_BRANCH_STACK) {
COMP(branch_stack->nr);
COMP(branch_stack->hw_idx);
for (i = 0; i < s1->branch_stack->nr; i++) {
if (needs_swap)
return ((host_is_bigendian()) ?
(FLAG(s2).value == BS_EXPECTED_BE) :
(FLAG(s2).value == BS_EXPECTED_LE));
else
MCOMP(branch_stack->entries[i]);
}
}
if (type & PERF_SAMPLE_REGS_USER) {
struct regs_dump *s1_regs = perf_sample__user_regs(s1);
struct regs_dump *s2_regs = perf_sample__user_regs(s2);
size_t sz = hweight_long(s1_regs->mask) * sizeof(u64);
COMP(user_regs->mask);
COMP(user_regs->abi);
if (s1_regs->abi &&
(!s1_regs->regs || !s2_regs->regs ||
memcmp(s1_regs->regs, s2_regs->regs, sz))) {
pr_debug("Samples differ at 'user_regs'\n");
return false;
}
}
if (type & PERF_SAMPLE_STACK_USER) {
COMP(user_stack.size);
if (memcmp(s1->user_stack.data, s2->user_stack.data,
s1->user_stack.size)) {
pr_debug("Samples differ at 'user_stack'\n");
return false;
}
}
if (type & PERF_SAMPLE_WEIGHT)
COMP(weight);
if (type & PERF_SAMPLE_WEIGHT_STRUCT) {
COMP(weight);
COMP(ins_lat);
COMP(weight3);
}
if (type & PERF_SAMPLE_DATA_SRC)
COMP(data_src);
if (type & PERF_SAMPLE_TRANSACTION)
COMP(transaction);
if (type & PERF_SAMPLE_REGS_INTR) {
struct regs_dump *s1_regs = perf_sample__intr_regs(s1);
struct regs_dump *s2_regs = perf_sample__intr_regs(s2);
size_t sz = hweight_long(s1_regs->mask) * sizeof(u64);
COMP(intr_regs->mask);
COMP(intr_regs->abi);
if (s1_regs->abi &&
(!s1_regs->regs || !s2_regs->regs ||
memcmp(s1_regs->regs, s2_regs->regs, sz))) {
pr_debug("Samples differ at 'intr_regs'\n");
Annotation
- Immediate include surface: `stdbool.h`, `inttypes.h`, `stdlib.h`, `string.h`, `linux/bitops.h`, `linux/kernel.h`, `linux/types.h`, `map_symbol.h`.
- Detected declarations: `function value`, `function do_test`, `function test__sample_parsing`.
- Atlas domain: Support Tooling And Documentation / tools.
- Implementation status: source implementation candidate.
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.