tools/testing/selftests/powerpc/benchmarks/futex_bench.c
Source file repositories/reference/linux-study-clean/tools/testing/selftests/powerpc/benchmarks/futex_bench.c
File Facts
- System
- Linux kernel
- Corpus path
tools/testing/selftests/powerpc/benchmarks/futex_bench.c- Extension
.c- Size
- 850 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
stdio.hsys/syscall.htime.hunistd.hlinux/futex.hutils.h
Detected Declarations
function test_futexfunction main
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright 2016, Anton Blanchard, Michael Ellerman, IBM Corp.
*/
#define _GNU_SOURCE
#include <stdio.h>
#include <sys/syscall.h>
#include <time.h>
#include <unistd.h>
#include <linux/futex.h>
#include "utils.h"
#define ITERATIONS 100000000
#define futex(A, B, C, D, E, F) syscall(__NR_futex, A, B, C, D, E, F)
int test_futex(void)
{
struct timespec ts_start, ts_end;
unsigned long i = ITERATIONS;
clock_gettime(CLOCK_MONOTONIC, &ts_start);
while (i--) {
unsigned int addr = 0;
futex(&addr, FUTEX_WAKE, 1, NULL, NULL, 0);
}
clock_gettime(CLOCK_MONOTONIC, &ts_end);
printf("time = %.6f\n", ts_end.tv_sec - ts_start.tv_sec + (ts_end.tv_nsec - ts_start.tv_nsec) / 1e9);
return 0;
}
int main(void)
{
test_harness_set_timeout(300);
return test_harness(test_futex, "futex_bench");
}
Annotation
- Immediate include surface: `stdio.h`, `sys/syscall.h`, `time.h`, `unistd.h`, `linux/futex.h`, `utils.h`.
- Detected declarations: `function test_futex`, `function main`.
- 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.