From nobody Wed Oct 30 09:02:44 2024 X-Original-To: dev-commits-ports-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Xdh3S3lsCz5by8F; Wed, 30 Oct 2024 09:02:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Xdh3S2zcJz4FnV; Wed, 30 Oct 2024 09:02:44 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1730278964; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=wMwgNsyxXSGJxRGPVxoVtQr+Rsx69reU2U8ZOHtdGWM=; b=hI94qucHDWKEQt7h1aSwkHiSq5ZuYKJBGNOECuD5U3EcErcRyJ3ofkscileY9ZUfRMtTf3 VSFNfiXyA8BzMpBiDiPQ6lVH87SbRNI/hxH8PRW5t2p87tLqYGgafX1qfWCsFTfX7yuTMW tc9oSgOg05MpR8N5JYisP4dU6FDCCXoKwonGk27EL1Rx9rx7QbTMrEiU11hN2UDv/o9SJN iZsNsKojODP/cdbddHPVvqqUVc35FQb6qiD//nGxZ0xapaG42CiGiEB6ZoyxkYanmMjE/t z1sibUti/l3QL6sE4OdLGdT69bWbXeSrLeH3RTveuQ9TqUBZqGdmR4mGzZF/8g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1730278964; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=wMwgNsyxXSGJxRGPVxoVtQr+Rsx69reU2U8ZOHtdGWM=; b=gnIFNuDOamV79/XbP11uM7Obu7N+zV/IRejHkoovez22iLXeKdAM9NoKCs9eTGGVUKwG5Q bJTql7BbbU5XoFPX7yOwb+wO/0BU4WJMa7D08+nbPdcDW4Qs/XfTJGNPjTD1ahP0JlCeJW O3TqDRqH07ErAp2LacadWsiCH0UJ4zfSQeDy1uwJDv0RUkRECqmeWWo5ehaR/Uc9Jv6Eno mbUiHbYwx1HZjGBIzNi/1kaVQddVxqhC+DeaErNeEWsxNKOfeC+D7Zfq919TxaCknYCQzd uleaUcNe/hqTpR1NtEkcTtNTTBSmFBP3A4DNGE9tt/j5h+Y2wwIvCMH9umjnzQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1730278964; a=rsa-sha256; cv=none; b=I3gCnXbx2JknmptIMuA5/FQS4HvMkdsXaHfZ48J3xTggBBRtSvv+5b73dnXwlTFouEy8FM KFXO1Hwtp0SAVrYBn2KLckdff7iFBj0xB1uB99li4qHNGOEeEjzj9m0dZyWSHcUkx5rIO5 i/gja7zNk5IBlVlflBf++qqhFELmmmaUpQkvLmgpOiXXyZt1QNboWBSJ7FJVg4b5uCHwDo UOUH091tTRFxVFpgeVks1hx/AYwqnPO/4bc6V9Lm+XmJWIcgsICzP+j1eJ7Lr+6mieBWl3 EgTt0L9IYeWnhtHbtxaVv6af82U/wD9y+NBtFCzYo6fGfHwBdrrQfH7a5H9IXw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Xdh3S2Y51z11ZB; Wed, 30 Oct 2024 09:02:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 49U92ijK013659; Wed, 30 Oct 2024 09:02:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 49U92i06013656; Wed, 30 Oct 2024 09:02:44 GMT (envelope-from git) Date: Wed, 30 Oct 2024 09:02:44 GMT Message-Id: <202410300902.49U92i06013656@gitrepo.freebsd.org> To: ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org From: Robert Clausecker Subject: git: fb1687157216 - main - benchmarks/libcpucycles: Microlibrary for counting CPU cycles List-Id: Commits to the main branch of the FreeBSD ports repository List-Archive: https://lists.freebsd.org/archives/dev-commits-ports-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-ports-main@freebsd.org Sender: owner-dev-commits-ports-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: fuz X-Git-Repository: ports X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: fb1687157216017a3c33d5b1890c3b2b75621735 Auto-Submitted: auto-generated The branch main has been updated by fuz: URL: https://cgit.FreeBSD.org/ports/commit/?id=fb1687157216017a3c33d5b1890c3b2b75621735 commit fb1687157216017a3c33d5b1890c3b2b75621735 Author: Robert Clausecker AuthorDate: 2024-10-29 18:26:54 +0000 Commit: Robert Clausecker CommitDate: 2024-10-30 09:00:37 +0000 benchmarks/libcpucycles: Microlibrary for counting CPU cycles 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 , 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. WWW: https://cpucycles.cr.yp.to/ Tested by: jhibbits --- benchmarks/Makefile | 1 + benchmarks/libcpucycles/Makefile | 39 +++++++++++++++++++++++++++++++++++++++ benchmarks/libcpucycles/distinfo | 3 +++ benchmarks/libcpucycles/pkg-descr | 20 ++++++++++++++++++++ benchmarks/libcpucycles/pkg-plist | 7 +++++++ 5 files changed, 70 insertions(+) diff --git a/benchmarks/Makefile b/benchmarks/Makefile index 8a7572e2a904..78b25950bdc5 100644 --- a/benchmarks/Makefile +++ b/benchmarks/Makefile @@ -39,6 +39,7 @@ SUBDIR += iperf3 SUBDIR += kdiskmark SUBDIR += libcelero + SUBDIR += libcpucycles SUBDIR += libmicro SUBDIR += linux-gputest SUBDIR += linux-unigine-heaven diff --git a/benchmarks/libcpucycles/Makefile b/benchmarks/libcpucycles/Makefile new file mode 100644 index 000000000000..d2180fd16f91 --- /dev/null +++ b/benchmarks/libcpucycles/Makefile @@ -0,0 +1,39 @@ +PORTNAME= libcpucycles +DISTVERSION= 20240318 +CATEGORIES= benchmarks devel +MASTER_SITES= https://cpucycles.cr.yp.to/ + +MAINTAINER= fuz@FreeBSD.org +COMMENT= Microlibrary for counting CPU cycles +WWW= https://cpucycles.cr.yp.to/ + +LICENSE= PD + +USES= python:build shebangfix +USE_LDCONFIG= yes +SHEBANG_FILES= configure scripts-build/* +HAS_CONFIGURE= yes +CONFIGURE_ARGS= --host=${ARCH} +ALL_TARGET= default +CFLAGS+= -fPIC -fwrapv -fvisibility=hidden + +_STAGE= ${WRKSRC}/build/0/package + +pre-configure: + ${ECHO} ${CC} ${CPPFLAGS} ${CFLAGS} ${LDFLAGS} >${WRKSRC}/compilers/default + +# no staging support for some reason +do-install: + ${INSTALL_MAN} ${_STAGE}/man/man1/cpucycles-info.1 ${STAGEDIR}${PREFIX}/share/man/man1/ + ${INSTALL_MAN} ${_STAGE}/man/man3/cpucycles.3 ${STAGEDIR}${PREFIX}/share/man/man3/ + ${INSTALL_DATA} ${_STAGE}/include/cpucycles.h ${STAGEDIR}${PREFIX}/include/ + for lib in ${_STAGE}/lib/libcpucycles* ; \ + do \ + ${INSTALL_LIB} $$lib ${STAGEDIR}${PREFIX}/lib/ ; \ + done + ${INSTALL_PROGRAM} ${_STAGE}/bin/cpucycles-info ${STAGEDIR}${PREFIX}/bin/ + +do-test: + ${SETENVI} LD_LIBRARY_PATH=${STAGEDIR}${PREFIX}/lib ${STAGEDIR}${PREFIX}/bin/cpucycles-info + +.include diff --git a/benchmarks/libcpucycles/distinfo b/benchmarks/libcpucycles/distinfo new file mode 100644 index 000000000000..7d9974242ff7 --- /dev/null +++ b/benchmarks/libcpucycles/distinfo @@ -0,0 +1,3 @@ +TIMESTAMP = 1730224174 +SHA256 (libcpucycles-20240318.tar.gz) = 19646a1b69d8f013647313fcedf15b6a89327a4b7ce553536d513f1f6e54d32d +SIZE (libcpucycles-20240318.tar.gz) = 42790 diff --git a/benchmarks/libcpucycles/pkg-descr b/benchmarks/libcpucycles/pkg-descr new file mode 100644 index 000000000000..ec932913c336 --- /dev/null +++ b/benchmarks/libcpucycles/pkg-descr @@ -0,0 +1,20 @@ +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 , 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. diff --git a/benchmarks/libcpucycles/pkg-plist b/benchmarks/libcpucycles/pkg-plist new file mode 100644 index 000000000000..8c9c0b661f23 --- /dev/null +++ b/benchmarks/libcpucycles/pkg-plist @@ -0,0 +1,7 @@ +bin/cpucycles-info +include/cpucycles.h +lib/libcpucycles.a +lib/libcpucycles.so +lib/libcpucycles.so.1 +share/man/man1/cpucycles-info.1.gz +share/man/man3/cpucycles.3.gz