Page MenuHomeFreeBSD

java/openjdk17: Implement "Current thread CPU time measurement"
AbandonedPublic

Authored by otis on Oct 9 2023, 12:05 PM.
Tags
None
Referenced Files
Unknown Object (File)
Jan 23 2024, 9:18 AM
Unknown Object (File)
Jan 14 2024, 2:18 PM
Unknown Object (File)
Dec 23 2023, 1:47 AM
Unknown Object (File)
Dec 10 2023, 8:35 PM
Unknown Object (File)
Nov 24 2023, 6:40 AM
Unknown Object (File)
Nov 17 2023, 3:52 AM
Unknown Object (File)
Nov 17 2023, 3:51 AM
Unknown Object (File)
Oct 10 2023, 4:53 PM
Subscribers

Details

Reviewers
glewis
Summary

Similarly to Linux, implement "Current thread CPU time measurement"
functionality.

Tested with recent UniFi controller (not yet in ports, that requires
OpenJDK 17+) which would not run properly without this functionaoity,
giving the following error:

ERROR [dispatcher] - Servlet.service() for servlet [dispatcher] in
context with path [] threw exception [Request processing failed; nested
exception is
com.google.common.util.concurrent.UncheckedExecutionException:
java.lang.UnsupportedOperationException: Current thread CPU time
measurement is not supported.]
with root cause
java.lang.UnsupportedOperationException: Current thread CPU time
measurement is not supported.

Diff Detail

Repository
R11 FreeBSD ports repository
Lint
No Lint Coverage
Unit
No Test Coverage
Build Status
Buildable 54078
Build 50968: arc lint + arc unit

Event Timeline

otis requested review of this revision.Oct 9 2023, 12:05 PM
otis created this revision.

I think this could be a lot simpler

java/openjdk17/files/patch-src_hotspot_os_bsd_os__bsd.cpp
6–9 ↗(On Diff #128448)

I don't think we need most of the code in this change. The Linux code is complicated because it has to deal with some Linux distributions or versions supporting this and others not. I don't believe this is true on FreeBSD. I think all supported FreeBSD platforms do support it and all this code has to do is just set _getcpuclockid to pthread_getcpuclockid here. It seems like OpenBSD and NetBSD also support it for recent versions, so I don't think we need any special casing for them either. Just an assignment.

otis marked an inline comment as done.Oct 15 2023, 9:40 AM

I think this could be a lot simpler

FWIW, I think https://github.com/battleblow/jdk17u/commit/b6c67a6eb191c1832815a76c990cac08bc9ee0f2 is all we need to do here. I haven't tested this against the UniFi controller though.

I think this could be a lot simpler

FWIW, I think https://github.com/battleblow/jdk17u/commit/b6c67a6eb191c1832815a76c990cac08bc9ee0f2 is all we need to do here. I haven't tested this against the UniFi controller though.

I will give it a go. This seems like a very simplified version of what they are doing for Linux (and that I took as a foundation for BSD).

In D42130#964712, @otis wrote:

I think this could be a lot simpler

FWIW, I think https://github.com/battleblow/jdk17u/commit/b6c67a6eb191c1832815a76c990cac08bc9ee0f2 is all we need to do here. I haven't tested this against the UniFi controller though.

I will give it a go. This seems like a very simplified version of what they are doing for Linux (and that I took as a foundation for BSD).

Ok, I've tested this and it works OK (as it is basically a simplified version of my proposed change).

I'll update the review.

Backport commit b6c67a6eb191c1832815a76c990cac08bc9ee0f2 from upstream.

In D42130#965494, @otis wrote:

A very friendly ping? :-)

Thank you for doing this Juraj! I think it is now obsolete as it got incorporated into the 17.0.9 update that got forced by the security announcement from Oracle late last week. The good news is that I was able to pull it into the new openjdk21 port as well