Internal Thread CPU times in JDK 17
Dylan Wragge
dylan.wragge at imc.com
Tue Sep 28 04:30:23 UTC 2021
Hey serviceability devs,
I'm currently looking to migrate our company's codebases to JDK 17 and am running into an issue where sun.management.HotspotThreadMBean and HotspotRuntimeMBean are no longer accessible from client code. We have a few internal metrics that use this MBean in order to provide counters on safepoint time and internal thread (GC/Compiler/etc) CPU time/usage.
Safepoint time is nicely exposed as JFR events, which can be consumed easily with the streaming JFR API. Internal thread CPU time is proving difficult to access however. Other APIs I've tried seem to hide the existence of the GC threads altogether (which we are most interested in). So far I've tried JFR's ThreadCPUTime event and JVMTI's GetAllThreads/GetThreadInfo, both of which don't seem to include any of the internal GC threads. The MBean also does not seem to be registered by default, so seems totally inaccessible. Although even if it were, JEP 396 would stop me accessing any of its methods.
Is there a supported method in JDK 17 to get this information? To me this seems like a reasonable use case. In the past, we've found these metrics extremely useful when evaluating and tuning new GCs. I managed to get something working by scraping /proc but it feels like there should be a better (and more portable) way.
- Dylan
[IMC Logo]<https://www.imc.com/us/>
[F]<https://www.facebook.com/IMCTrading>
[t]<http://twitter.com/IMCTrading>
[I]<https://www.instagram.com/imctrading/>
[in]<https://www.linkedin.com/company/imc-financial-markets>
imc.com<https://www.imc.com/us/>
________________________________
The information in this e-mail is intended only for the person or entity to which it is addressed.
It may contain confidential and /or privileged material. If you are not the intended recipient, please notify us immediately and delete it from your system. Any other use or disclosure by you, including through automated tools operating on your systems is prohibited.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.java.net/pipermail/serviceability-dev/attachments/20210928/5f13ae90/attachment.htm>
More information about the serviceability-dev
mailing list