tools/perf/bench/futex.c

Source file repositories/reference/linux-study-clean/tools/perf/bench/futex.c

File Facts

System
Linux kernel
Corpus path
tools/perf/bench/futex.c
Extension
.c
Size
1741 bytes
Lines
65
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.

Dependency Surface

Detected Declarations

Annotated Snippet

if (ret != params->nbuckets) {
			if (ret < 0) {
				printf("Can't query number of buckets: %m\n");
				err(EXIT_FAILURE, "prctl(PR_FUTEX_HASH)");
			}
			printf("Requested number of hash buckets does not currently used.\n");
			printf("Requested: %d in usage: %d\n", params->nbuckets, ret);
			err(EXIT_FAILURE, "prctl(PR_FUTEX_HASH)");
		}
		if (params->nbuckets == 0)
			ret = asprintf(&futex_hash_mode, "Futex hashing: global hash");
		else
			ret = asprintf(&futex_hash_mode, "Futex hashing: %d hash buckets",
				       params->nbuckets);
	} else {
		if (ret <= 0) {
			ret = asprintf(&futex_hash_mode, "Futex hashing: global hash");
		} else {
			ret = asprintf(&futex_hash_mode, "Futex hashing: auto resized to %d buckets",
				       ret);
		}
	}
	if (ret < 0)
		err(EXIT_FAILURE, "ENOMEM, futex_hash_mode");
	printf("%s\n", futex_hash_mode);
	free(futex_hash_mode);
}

Annotation

Implementation Notes