On Tue, 19 Aug 2025 11:27:53 GMT, Albert Mingkun Yang <[email protected]> wrote:
>> Jonas Norlinder has updated the pull request incrementally with one
>> additional commit since the last revision:
>>
>> Remove unused
>
> src/hotspot/share/services/cpuTimeUsage.hpp line 47:
>
>> 45: static jlong gc_threads();
>> 46: static jlong vm_thread();
>> 47: static jlong stringdedup();
>
> I feel the API surface contains some redundancy.
>
> For example, the GC-part API design exposes two ways to query and they are
> essentially the same -- for the sake of simplicity, I'd suggest keeping only
> one.
>
> The calculation of `total` should be done by users of this API, I believe,
> when/if total is desirable.
The motivation for `total()` is that this is probably what most users want, but
in case anyone want a sub-component I also expose each one of them. It also
serves as documentation as what we currently consider to be "total", so I would
prefer keeping it.
If you look at e.g. `WeakProcessor::CountingClosure` the following is defined
size_t dead() const { return _old_dead + _new_dead; }
size_t new_dead() const { return _new_dead; }
size_t total() const { return dead() + _live; }
so having such convenience method in hotspot is not unprecedented and I would
prefer keeping it.
`statistics()` is a less important convenience method that can be removed.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/26621#discussion_r2285510749