Index | Thread | Search

From:
Miguel Landaeta <miguel@miguel.cc>
Subject:
[MAINTAINER UPDATE] misc/libcpucycles (20250925 -> 20260105)
To:
ports@openbsd.org
Date:
Mon, 6 Apr 2026 10:41:17 +0000

Download raw body.

Thread
  • Miguel Landaeta:

    [MAINTAINER UPDATE] misc/libcpucycles (20250925 -> 20260105)

Upgrade to 20260105

Changelog:

Split amd64-pmc, arm64-pmc, riscv32-rdcycle, and riscv64-rdcycle into perf and non-perf versions, with the perf versions tried first. Hopefully the perf versions will also eliminate the need to install kernel modules for amd64-pmc and arm64-pmc.

For amd64-pmc, always use fixed-function cycle counter (1<<30)|1. This works around a bug in, e.g., kernel 6.1.0 perf incorrectly returning index 0 for E-cores.

For all perf-based counters, use PERF_FLAG_FD_CLOEXEC if it is available.

For *tsc* counters, return invariant TSC frequency if that is clear from CPUID information. Thanks to Tee-Kiah Chia for the suggestion and a prototype patch.

Add internal ticks_close(), most importantly for closing perf descriptors. (An alternative would be to unify the perf handling inside a single perf_event_open in wrapper conditioned on Linux, but this raises the question of how to handle perf platform variations such as arm64-pmc needing 3 in config1.)

Increase penalty for EXTEND32 counters. (It might be better to directly benchmark the extension.)

Increase penalty for fixed-frequency counters, including RDTSC when it is known to be invariant.

For wrapper, use sigjmp_buf instead of jmp_buf.

Document requirements on /sys/devices/cpu*/rdpmc and /proc/sys/kernel/perf_user_access. Add cpucycles-open abstraction.

Update configure: recognize a few more x86 synonyms; --no- instead of --no; support configure.log.

Support $DESTDIR in install. Thanks to Robert Clausecker for the suggestion.

Bigger split of RDPMC-based counters to handle not just perf sometimes incorrectly returning index 0 on Intel but also AMD not supporting fixed-function counter 0x40000001. New amd64-perfpmcff tries fixed-function counter 0x40000001 within perf; amd64-perfpmc now goes back to trying index returned by perf; amd64-pmcff (renamed from amd64-pmc) tries fixed-function counter 0x40000001 outside perf.

Add orderbump mechanism, for example to prefer tsc more systematically over tscasm.


Please see the diff below.

Thanks,
Miguel.



Index: Makefile
===================================================================
RCS file: /home/cvs/ports/misc/libcpucycles/Makefile,v
diff -u -p -u -p -r1.5 Makefile
--- Makefile	22 Dec 2025 12:28:07 -0000	1.5
+++ Makefile	6 Apr 2026 10:14:22 -0000
@@ -1,6 +1,6 @@
 COMMENT=		library for counting CPU cycles
 
-V=			20250925
+V=			20260105
 DISTNAME=		libcpucycles-${V}
 SHARED_LIBS+=		cpucycles	0.0	# 1.0
 CATEGORIES=		misc
@@ -26,5 +26,6 @@ CONFIGURE_ARGS+=	--prefix="${WRKINST}${P
 			--soversion="${LIBcpucycles_VERSION}"
 ALL_TARGET=
 MAKE_FLAGS+=		LIBcpucycles_VERSION=${LIBcpucycles_VERSION}
+FAKE_FLAGS=		DESTDIR=
 
 .include <bsd.port.mk>
Index: distinfo
===================================================================
RCS file: /home/cvs/ports/misc/libcpucycles/distinfo,v
diff -u -p -u -p -r1.3 distinfo
--- distinfo	22 Dec 2025 12:28:07 -0000	1.3
+++ distinfo	6 Apr 2026 10:04:34 -0000
@@ -1,2 +1,2 @@
-SHA256 (libcpucycles-20250925.tar.gz) = YjE9Qq1aPL2NQan7cIjtwyjvSZ1Cbh8ZFhIzHQ/L4wE=
-SIZE (libcpucycles-20250925.tar.gz) = 48447
+SHA256 (libcpucycles-20260105.tar.gz) = 6H3KqijpBbV0zPPUniPgXHPts/mRNtzVZryhaCmrZpQ=
+SIZE (libcpucycles-20260105.tar.gz) = 58997
Index: patches/patch-configure_fix_soname
===================================================================
RCS file: /home/cvs/ports/misc/libcpucycles/patches/patch-configure_fix_soname,v
diff -u -p -u -p -r1.2 patch-configure_fix_soname
--- patches/patch-configure_fix_soname	27 Jan 2025 12:55:05 -0000	1.2
+++ patches/patch-configure_fix_soname	6 Apr 2026 10:10:33 -0000
@@ -3,7 +3,7 @@ Fix library soname.
 Index: configure
 --- configure.orig
 +++ configure
-@@ -10,6 +10,7 @@
+@@ -10,6 +10,7 @@ import tempfile
  prefix = '/usr/local'
  clean = True
  darwin = platform.system() == 'Darwin'
@@ -11,7 +11,7 @@ Index: configure
  
  def hostsanitize(host):
    host = host.split('-')[0]
-@@ -43,6 +44,9 @@
+@@ -51,6 +52,9 @@ for arg in sys.argv[1:]:
    if arg.startswith('--host='):
      host = hostsanitize(arg[7:])
      continue
@@ -21,15 +21,15 @@ Index: configure
    if arg == '--clean':
      clean = True
      continue
-@@ -60,6 +64,7 @@
+@@ -68,6 +72,7 @@ for arg in sys.argv[1:]:
  echoargs = './configure'
  echoargs += ' --prefix=%s' % prefix
  echoargs += ' --host=%s' % host
 +echoargs += ' --soversion=%s' % soversion
  if clean: echoargs += ' --clean'
- if not clean: echoargs += ' --noclean'
+ if not clean: echoargs += ' --no-clean'
  if darwin: echoargs += ' --darwin'
-@@ -96,7 +101,7 @@
+@@ -104,7 +109,7 @@ dirlinksym('build/%s/scripts'%host,'install','../src/s
  # ----- shared-library variations
  
  so = 'dylib' if darwin else 'so'
@@ -38,7 +38,7 @@ Index: configure
  soname = 'install_name' if darwin else 'soname'
  syslibs = '-lm' if darwin else '-lm -lrt'
  
-@@ -245,17 +250,11 @@
+@@ -258,17 +263,11 @@ with open('build/%s/scripts/sharedlib' % host,'w') as 
    f.write(f'chmod 644 package/lib/libcpucycles.{so1}\n')
  os.chmod('build/%s/scripts/sharedlib' % host,0o755)
  
@@ -57,7 +57,7 @@ Index: configure
  # ----- command
  
  os.makedirs('build/%s/command'%host)
-@@ -284,8 +283,8 @@
+@@ -308,8 +307,8 @@ for fn in sorted(os.listdir('command')):
    M += '\tscripts/compiledefault command %s c -I include\n' % base
    M += '\n'
    makefile = M + makefile
@@ -68,7 +68,7 @@ Index: configure
    M += '\n'
    makefile = M + makefile
    commands += ['package/bin/%s' % base]
-@@ -303,7 +302,7 @@
+@@ -327,7 +326,7 @@ makefile = M + makefile
  
  # ----- make default
  
Index: patches/patch-configure_remove_librt
===================================================================
RCS file: /home/cvs/ports/misc/libcpucycles/patches/patch-configure_remove_librt,v
diff -u -p -u -p -r1.2 patch-configure_remove_librt
--- patches/patch-configure_remove_librt	27 Jan 2025 12:55:05 -0000	1.2
+++ patches/patch-configure_remove_librt	6 Apr 2026 10:10:33 -0000
@@ -3,9 +3,9 @@ OpenBSD neither provides nor requires li
 Index: configure
 --- configure.orig
 +++ configure
-@@ -103,7 +103,7 @@
+@@ -111,7 +111,7 @@ dirlinksym('build/%s/scripts'%host,'install','../src/s
  so = 'dylib' if darwin else 'so'
- so1 = soversion
+ so1 = f'so.{soversion}'
  soname = 'install_name' if darwin else 'soname'
 -syslibs = '-lm' if darwin else '-lm -lrt'
 +syslibs = '-lm'
Index: patches/patch-configure_translate_host_arch
===================================================================
RCS file: /home/cvs/ports/misc/libcpucycles/patches/patch-configure_translate_host_arch,v
diff -u -p -u -p -r1.3 patch-configure_translate_host_arch
--- patches/patch-configure_translate_host_arch	22 Dec 2025 12:28:07 -0000	1.3
+++ patches/patch-configure_translate_host_arch	6 Apr 2026 10:10:33 -0000
@@ -5,7 +5,7 @@ Index: configure
 +++ configure
 @@ -19,6 +19,7 @@ def hostsanitize(host):
      ('amd64','amd64'), ('x86_64','amd64'),
-     ('x86','x86'), ('i386','x86'), ('i686','x86'),
+     ('x86','x86'), ('i386','x86'), ('i486','x86'), ('i586','x86'), ('i686','x86'),
      ('arm64','arm64'), ('armv8','arm64'), ('aarch64','arm64'),
 +    ('armv7','arm32'),
      ('arm','arm32'),