FreeBSD Ports

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.

Repositoryaarch64amd64armv6armv7i386
FreeBSD:14:latest2026090120260901-20240318_220260901
FreeBSD:14:quarterly2026090120260901n/a20240318_220260901
FreeBSD:15:latest2026090120260901n/a20240318_220240318_2
FreeBSD:15:quarterly2026090120260901n/an/an/a
FreeBSD:16:latest2026090120260901n/an/an/a
FreeBSD:16:quarterlyn/an/an/an/an/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
FileSizeSHA256
libcpucycles-20260901.tar.gz64694c914c7275952ed00bb188e1170409c83b61abfd0b828cdb2b5a87275be43344e
Master sites 1
  • https://cpucycles.cr.yp.to/

Commit history 1

DateCommitCreditsLog message
360f397e95 Robert Clausecker benchmarks/libcpucycles: update to 20260901
Changelog: https://cpucycles.cr.yp.to/download.html Event: Berlin Hackathon 202609