tools/perf/tests/sw-clock.c
Source file repositories/reference/linux-study-clean/tools/perf/tests/sw-clock.c
File Facts
- System
- Linux kernel
- Corpus path
tools/perf/tests/sw-clock.c- Extension
.c- Size
- 3550 bytes
- Lines
- 153
- 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
errno.hinttypes.hunistd.hstdlib.hsignal.hsys/mman.hlinux/compiler.hlinux/string.htests.hutil/debug.hutil/evsel.hutil/evlist.hutil/cpumap.hutil/mmap.hutil/sample.hutil/thread_map.hperf/evlist.hperf/mmap.h
Detected Declarations
function eventsfunction test__sw_clock_freq
Annotated Snippet
if (err < 0) {
pr_debug("Error during parse sample\n");
perf_sample__exit(&sample);
goto out_delete_evlist;
}
total_periods += sample.period;
nr_samples++;
next_event:
perf_mmap__consume(&md->core);
perf_sample__exit(&sample);
}
perf_mmap__read_done(&md->core);
out_init:
if ((u64) nr_samples == total_periods) {
pr_debug("All (%d) samples have period value of 1!\n",
nr_samples);
err = -1;
}
out_delete_evlist:
perf_cpu_map__put(cpus);
perf_thread_map__put(threads);
evlist__delete(evlist);
return err;
}
static int test__sw_clock_freq(struct test_suite *test __maybe_unused, int subtest __maybe_unused)
{
int ret;
ret = __test__sw_clock_freq(PERF_COUNT_SW_CPU_CLOCK);
if (!ret)
ret = __test__sw_clock_freq(PERF_COUNT_SW_TASK_CLOCK);
return ret;
}
DEFINE_SUITE("Software clock events period values", sw_clock_freq);
Annotation
- Immediate include surface: `errno.h`, `inttypes.h`, `unistd.h`, `stdlib.h`, `signal.h`, `sys/mman.h`, `linux/compiler.h`, `linux/string.h`.
- Detected declarations: `function events`, `function test__sw_clock_freq`.
- 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.