On Wed, 15 Oct 2025 10:14:21 GMT, Kevin Walls <[email protected]> wrote:

>> Jonas Norlinder has updated the pull request incrementally with one 
>> additional commit since the last revision:
>> 
>>   Move from j.l.management to com.sun.management etc.
>
> Or:
> 
> 
>      * @implNote Time calculation is implementation-specific, and may include 
> details
>        * such as CPU time for driver threads, workers, VM Operations and 
> string deduplication. 
>        * The return value can be -1 if called when measurement is not 
> possible, such as during shutdown.

@kevinjwalls 

> Particularly on this method about GC time, I don't really follow the 
> reasoning for not accepting the method in java.lang.MemoryMXBean.
>
> The most generic Java API can admit that Java is Garbage-Collected, and that 
> doing that work can take some CPU time.

I think I'm leaning towards jdk.lang/com.sun over java.lang since there are GC 
algorithms out there (which we don't have in HotSpot), that make this method 
sometimes less useful. A method in java.lang may need to consider the most 
generic situation. For instance, GCs that pushes out most of its work onto 
mutators. It may be hard to accurately measure this at mutator level and we 
don't want to force JDK implementors to do so. As such this should be 
categorized as a JDK-specific method. I understand we would prefer jdk.lang 
over com.sun for new additions?

-------------

PR Comment: https://git.openjdk.org/jdk/pull/27537#issuecomment-3433172604

Reply via email to