From nobody Mon Nov 02 18:51:08 2026 X-Original-To: java@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 4jJLQ43tYYz6yD4C for ; Mon, 02 Nov 2026 18:51:08 +0000 (UTC) (envelope-from bugzilla-noreply@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) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 4jJLQ40tDJz4P8F for ; Mon, 02 Nov 2026 18:51:08 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1793645468; 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: in-reply-to:in-reply-to:references:references; bh=qtdqyGdAkSW4zh3BT1gvPsA6VIdi1Z0y183lTadlnJg=; b=mvL6ioexF7gO+1CdzwQDdZ9rkyQtDOict+ho5QHCOL4oYjRyxBmOqYsPfukTqYvoCs4Sli 1aSpXNTaG83vj0R1bDgmfazUBkUyYhurQ6xkN4Fj759XBIKEIeZ89CNnOB2tUq7EYNMx+M EmJpusPJIqDuTGseaGDPBF24CiONrMt67LdByKXO6jKEtgH4wirhBjJMxCHVo2s0aD2Bcr hrgVt/FMErTtdePx6xF2OWUBH3dmMnVJlwzjqPQuPTzPd8eb3/MqirOi9xND29iy4UJC2X NKKDlGa8q7Q5GIRgxJHFU3G+frf2bUPXfyMSoc2BVXKrdQPFirnysE12/LJ8Zw== ARC-Seal: i=1; a=rsa-sha256; d=freebsd.org; s=dkim; cv=none; t=1793645468; b=hP/Rk6o/cfYHjVUmsRsTwjEFs7xiHsF9tfXNc+zfEY4qXrrlDNRfD7xGRtRlIbDm8m3quJ /qo+IdNff63/ekMjTopwmrBDlzkjlgatSaoGutppEroNUlg98+oXLLSDN3S8KE5WiR/qOa VPe05PUmEhtNowr45TMKd1fcHf7+W3pg4a8tNhXf8onFvzeDrQbPQ5MKRjuqXZ6GtFWsSO OPo0ywJP8dbOpCFqNf2POXRpauKOOrXLGN6u9xgcVA11OmdquSK8nd2s8nBrHhF6xNtEsz 8znhXwpbGO5yyGZi8Q0gq+JNpZrgsX5ngU/74itUfFrVg0KPtnUuQDgRVczM1A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1793645468; 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: in-reply-to:in-reply-to:references:references; bh=qtdqyGdAkSW4zh3BT1gvPsA6VIdi1Z0y183lTadlnJg=; b=nIzp4++g+4H6Hk3LZhUqqzciGuO/dsUE/bvNTOkFFSyrRlBARDfzMfPbkD6aT0YqIQc1kj LP+LpB9UCRVf/TzAVkiDRBYYBJ+GPvFmyLwMMIDeSsxVnZ/6Hrimjeru8TVRGl46C2A60M UjF/aZAfdK/B8I7clQOcLT+eZfid+gDkXNMrleAlRe8WR3BowrEQCXMTokqe68iSzPCdr1 BnM7/K0x0T+Gth0CMyD9r6ndSx7Ft5MxyUYckR1rX1ZUtA049PwgUatpsfpYaCjTUVrvaL xrXsBvJILHRx95w8wiv7J+JFrjTxijzkiAlROpnoy6j6dbn34mhsrHSgD7wm5w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2610:1c1:1:606c::50:1d]) (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 4jJLQ40TlKzyBq for ; Mon, 02 Nov 2026 18:51:08 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org ([127.0.1.5]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id 6A2Ip8CM098478 for ; Mon, 2 Nov 2026 18:51:08 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 6A2Ip8x1098467 for java@FreeBSD.org; Mon, 2 Nov 2026 18:51:08 GMT (envelope-from bugzilla-noreply@freebsd.org) X-Authentication-Warning: kenobi.freebsd.org: www set sender to bugzilla-noreply@freebsd.org using -f From: bugzilla-noreply@freebsd.org To: java@FreeBSD.org Subject: [Bug 300333] java/openjdk25: getCurrentThreadCpuTime() does not return the actual time in nanoseconds Date: Mon, 02 Nov 2026 18:51:08 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Ports & Packages X-Bugzilla-Component: Individual Port(s) X-Bugzilla-Version: Latest X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Some People X-Bugzilla-Who: saro@saromedia.com X-Bugzilla-Status: Open X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: ports-bugs@FreeBSD.org X-Bugzilla-Flags: maintainer-feedback? X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="UTF-8" X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated List-Archive: https://lists.freebsd.org/archives/freebsd-java Sender: owner-freebsd-java@FreeBSD.org List-Id: Porting Java to FreeBSD List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D300333 --- Comment #4 from Saro --- (In reply to Harald Eilertsen from comment #2) Hi Harald, I appreciate the quick follow-up! I ran the test C++ code and am seeing identical results: the granularity of= the returned values is way too coarse. I have tested this on 2 separate physical machines (no VMs or Jails) running FreeBSD 14.5-p2. I understand that the `getCurrentThreadCpuTime()` does not guarantee nanose= cond accuracy, however running the same Java test on a test Debian 12 (physical) machine returns a pristine 0 for `zero deltas`. Is this a limitation with the FreeBSD kernel? From my understanding, it is possible to return CPU thread time in nanoseconds using `CLOCK_THREAD_CPUTIME_ID` when passing it to `clock_gettime()` based on https://github.com/freebsd/freebsd-src/blob/releng/14.5/sys/kern/kern_time.= c#L364 I noticed the Linux implementation is also using `CLOCK_THREAD_CPUTIME_ID` = with `clock_gettime` based on https://github.com/freebsd/openjdk/blob/jdk25u-freebsd/src/hotspot/os/linux= /os_linux.cpp#L5227 and https://github.com/freebsd/openjdk/blob/jdk25u-freebsd/src/hotspot/os/linux= /os_linux.cpp#L4443 (with a fallback to pthread somewhere, IIRC). When I modified your test code to utilize `CLOCK_THREAD_CPUTIME_ID` alone, = the results were perfect: `zero deltas` was 0, with the lowest non-zero step be= ing ~263 ns. It's entirely possible I'm not fully understanding the code, kernel or the implementation (I'm more of a Java guy...) so I apologize in advance for wasting your time. Thank you! --=20 You are receiving this mail because: You are on the CC list for the bug.=