Getting per-thread CPU time on *BSD
Harald Eilertsen
harald+jdklists at volse.no
Wed Jun 25 14:23:50 UTC 2025
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://github.com/freebsd/openjdk/blob/jdk24u-freebsd/src/hotspot/os/bsd/os_bsd.cpp#L2609
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.
> 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.
> Just out of curiosity, do you happen to know why the changes for *BSD are
> not upstreamed?
No, I don't know why, only that's where we are. I am contracted by The
FreeBSD Foundation to try to get the port(s) upstreamed. So far it's
been a lot of cleanup, and catch up to get everything ported on top of
the mainline repo. :)
Best regards,
Harald
More information about the bsd-port-dev
mailing list