For some years now, FreeBSD java users have encountered: java.lang.UnsupportedOperationException: Thread CPU time measurement is not supported. at sun.management.ThreadImpl.verifyThreadCpuTime(ThreadImpl.java:232) at sun.management.ThreadImpl.getThreadCpuTime(ThreadImpl.java:251) at sun.management.ThreadImpl.getThreadCpuTime(ThreadImpl.java:222) which is particularly problematic when dealing with (buggy) software that assumes getThreadCpuTime() calls will succeed. Will Andrews has apparently fixed this issue, see: http://mail.openjdk.java.net/pipermail/bsd-port-dev/2015-May/002557.html for a description and patches. It would be great to have this issue fixed in the JDKs distributed with FreeBSD.
I'll take it.
A commit references this bug: Author: jkim Date: Wed Dec 23 00:22:15 UTC 2015 New revision: 404270 URL: https://svnweb.freebsd.org/changeset/ports/404270 Log: Implement ThreadMXBean.getThreadCpuTime(), etc. PR: 205523 Submitted by: will (via bsd-port-dev@openjdk.java.net) Changes: head/java/openjdk8/Makefile head/java/openjdk8/files/patch-hotspot_src_os_bsd_vm_os__bsd.cpp head/java/openjdk8/files/patch-hotspot_src_os_bsd_vm_os__bsd.hpp
Committed with minor style changes (r404270), thanks!
A commit references this bug: Author: jkim Date: Wed Dec 23 00:47:12 UTC 2015 New revision: 404273 URL: https://svnweb.freebsd.org/changeset/ports/404273 Log: Fix the previous commit. We do not support getThreadUserTime(). PR: 205523 Changes: head/java/openjdk8/files/patch-hotspot_src_os_bsd_vm_os__bsd.cpp
That was quick! Thanks, Jung-uk. Wouldn't it be worth supporting getThreadUserTime()? AFAICS this is supported by FreeBSD 8.1+ through getrusage(RUSAGE_THREAD, ...).
A commit references this bug: Author: jkim Date: Tue Jan 5 22:39:47 UTC 2016 New revision: 405320 URL: https://svnweb.freebsd.org/changeset/ports/405320 Log: - Partially implement getThreadUserTime() using getrusage(2). Note we can only get usage for the current thread. Return -1 if the requested function is not supported, i.e., user time for other threads, rather than crash. [1] - Properly implement os::elapsedVTime() using getrusage(). Basically, it is taken from Linux version. - Temporarily revert r403748 to fix bootstrapping with earlier OpenJDK8. [2] PR: 205523, 205843 [1] PR: 205544 [2] Changes: head/java/openjdk8/Makefile head/java/openjdk8/files/patch-hotspot_src_os_bsd_vm_os__bsd.cpp
A commit references this bug: Author: jkim Date: Wed Jan 13 18:13:57 UTC 2016 New revision: 406064 URL: https://svnweb.freebsd.org/changeset/ports/406064 Log: MFH: r405058, r405320 - Stub implementation of OperatingSystemImpl. - Partially implement getThreadUserTime() using getrusage(2). Note we can only get usage for the current thread. Return -1 if the requested function is not supported, i.e., user time for other threads, rather than crash. - Properly implement os::elapsedVTime() using getrusage(). Basically, it is taken from Linux version. - Temporarily revert r403748 to fix bootstrapping with earlier OpenJDK8. PR: 205229, 205523, 205544, 205843 Approved by: ports-secteam (feld) Changes: _U branches/2016Q1/ branches/2016Q1/java/openjdk8/Makefile branches/2016Q1/java/openjdk8/files/patch-hotspot_src_os_bsd_vm_os__bsd.cpp branches/2016Q1/java/openjdk8/files/patch-jdk-src-solaris-native-sun-management-BsdOperatingSystem.c