benchmarks/libcpucycles 20240318_2 DragonFly
Microlibrary for counting CPU cycles
- System
- DragonFly
- Repository
- DPorts
- Maintainer
- [email protected] (as in FreeBSD)
- License
- PD
- Categories
- benchmarks, devel
- Package size
- 10.6 KiB, 45.5 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.
In the other systems
| System | Port | Version |
|---|---|---|
| DragonFly | benchmarks/libcpucycles | 20240318_2 |
| FreeBSD | benchmarks/libcpucycles | 20260901 |
| OpenBSD | misc/libcpucycles | 20260105 |
| HardenedBSD | benchmarks/libcpucycles | 20260901 |
| GhostBSD | benchmarks/libcpucycles | 20260901 |
Install
Binary package:
pkg install libcpucycles
From DPorts:
cd /usr/dports/benchmarks/libcpucycles && make install clean
Dependencies
No port depends on this one.