tools/lib/perf/tests/test-cpumap.c
Source file repositories/reference/linux-study-clean/tools/lib/perf/tests/test-cpumap.c
File Facts
- System
- Linux kernel
- Corpus path
tools/lib/perf/tests/test-cpumap.c- Extension
.c- Size
- 795 bytes
- Lines
- 44
- 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
stdarg.hstdio.hperf/cpumap.hinternal/tests.htests.h
Detected Declarations
function libperf_printfunction test_cpumap
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0
#include <stdarg.h>
#include <stdio.h>
#include <perf/cpumap.h>
#include <internal/tests.h>
#include "tests.h"
static int libperf_print(enum libperf_print_level level,
const char *fmt, va_list ap)
{
return vfprintf(stderr, fmt, ap);
}
int test_cpumap(int argc, char **argv)
{
struct perf_cpu_map *cpus;
struct perf_cpu cpu;
int idx;
__T_START;
libperf_init(libperf_print);
cpus = perf_cpu_map__new_any_cpu();
if (!cpus)
return -1;
perf_cpu_map__get(cpus);
perf_cpu_map__put(cpus);
perf_cpu_map__put(cpus);
cpus = perf_cpu_map__new_online_cpus();
if (!cpus)
return -1;
perf_cpu_map__for_each_cpu(cpu, idx, cpus)
__T("wrong cpu number", cpu.cpu != -1);
perf_cpu_map__put(cpus);
__T_END;
return tests_failed == 0 ? 0 : -1;
}
Annotation
- Immediate include surface: `stdarg.h`, `stdio.h`, `perf/cpumap.h`, `internal/tests.h`, `tests.h`.
- Detected declarations: `function libperf_print`, `function test_cpumap`.
- 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.