benchmarks/libcpucycles 20260901
Microlibrary for counting CPU cycles
- Repository
- FreeBSD ports
- Maintainer
- [email protected]
- Last update
- Commit
360f397e95- License
- PD
- Categories
- benchmarks, devel
- Package size
- 16.9 KiB, 63.2 KiB installed
Description
libcpucycles is a microlibrary for counting CPU cycles. Cycle counts are not as detailed as Falk diagrams but are the most precise timers available to typical software; they are central tools used in understanding and improving software performance.
The libcpucycles API is simple: include <cpucycles.h>, call cpucycles() to receive a long long whenever desired, and link with -lcpucycles.
Internally, libcpucycles understands machine-level cycle counters for amd64 (both PMC and TSC), arm32, arm64 (both PMC and VCT), mips64, ppc32, ppc64, riscv32, riscv64, s390x, sparc64, and x86. libcpucycles also understands four OS-level mechanisms, which give varying levels of accuracy: mach_absolute_time, perf_event, CLOCK_MONOTONIC, and, as a fallback, microsecond-resolution gettimeofday.
When the program first calls cpucycles(), libcpucycles automatically benchmarks the available mechanisms and selects the mechanism that does the best job. Subsequent cpucycles() calls are thread-safe and very fast. An accompanying cpucycles-info program prints a summary of cycle-counter accuracy.
Install
As a binary package — by origin, or by package name:
pkg install benchmarks/libcpucycles
pkg install libcpucycles
From the ports tree:
cd /usr/ports/benchmarks/libcpucycles/ && make install clean
To depend on this port in another port's Makefile:
RUN_DEPENDS= libcpucycles>0:benchmarks/libcpucycles
LIB_DEPENDS= libcpucycles.so:benchmarks/libcpucycles
Packages
The version each package repository carries. “-” means the repository builds no package of it, “n/a” that there is no such repository.
| Repository | aarch64 | amd64 | armv6 | armv7 | i386 |
|---|---|---|---|---|---|
| FreeBSD:14:latest | 20260901 | 20260901 | - | 20240318_2 | 20260901 |
| FreeBSD:14:quarterly | 20260901 | 20260901 | n/a | 20240318_2 | 20260901 |
| FreeBSD:15:latest | 20260901 | 20260901 | n/a | 20240318_2 | 20240318_2 |
| FreeBSD:15:quarterly | 20260901 | 20260901 | n/a | n/a | n/a |
| FreeBSD:16:latest | 20260901 | 20260901 | n/a | n/a | n/a |
| FreeBSD:16:quarterly | n/a | n/a | n/a | n/a | n/a |
Dependencies
The Makefile names none itself; they come from USES and USE_*.
The full lists below include those, and their dependencies in turn.
All build dependencies 7
No port depends on this one.
Configuration
No options to configure.
- USES
- python:build shebangfix
- Service scripts
- none
Files
Manual pages 3
- cpucycles(3)
- cpucycles-info(1)
- cpucycles-open(1)
pkg-plist 9
- bin/cpucycles-info
- bin/cpucycles-open
- include/cpucycles.h
- lib/libcpucycles.a
- lib/libcpucycles.so
- lib/libcpucycles.so.1
- share/man/man1/cpucycles-info.1.gz
- share/man/man1/cpucycles-open.1.gz
- share/man/man3/cpucycles.3.gz
distinfo 1
| File | Size | SHA256 |
|---|---|---|
| libcpucycles-20260901.tar.gz | 64694 | c914c7275952ed00bb188e1170409c83b61abfd0b828cdb2b5a87275be43344e |
Master sites 1
- https://cpucycles.cr.yp.to/