Hi Harald,

On 25.06.25 16:23, Harald Eilertsen wrote:
Hi Thomas,

On Wed, Jun 25, 2025 at 01:48:58PM +0200, Thomas Schatzl wrote:
   actually it looks like there is at least a JDK 21 port which has the
necessary infrastructure implemented.

Yes, you'll also find the same in the latest update repo for FreeBSD:
https://urldefense.com/v3/__https://github.com/freebsd/openjdk/blob/jdk24u-freebsd/src/hotspot/os/bsd/os_bsd.cpp*L2609__;Iw!!ACWV5N9M2RV99hQ!NOYYAR0rODCedfhq33DuAWwlenmBRQUMpw2ViZNgd34uafcKc0KBA_77dZc1wwPk6In2YGb7X_pe0ABnhHROAzR-U_4CueGo$

However, this implementation does not provide for getting only user time
except for OpenBSD (and presumably OS X), unless it's a request for the
timing of the current thread.

I have improved on that, so it should also fully work on FreeBSD. I'll
include that in the JDK 24.0.2 release and in my fork of the mainline
repo.

For GC we only need user+sys time, so that would be sufficient. The only user of user-only time seems to be Java's ThreadMXBean.

However an implementation may not support getting another thread's user time afaict (https://docs.oracle.com/en/java/javase/24/docs/api/java.management/java/lang/management/ThreadMXBean.html#getThreadUserTime(long), see the remark in the UnsupportedException description).


Not sure how to proceed here for adding the suggested changes to mainline.

Me neither, I hope to be able to upstream the full port some time, but
it will have to happen in increments.


That would be great, and doing this incrementally is understandable (and favorable to reviewers :)).

Thomas

Reply via email to