RFR: 8261447: MethodInvocationCounters frequently run into overflow

Tobias Hartmann thartmann at openjdk.java.net
Thu Feb 11 08:36:39 UTC 2021


On Wed, 10 Feb 2021 16:28:29 GMT, Lutz Schmidt <lucy at openjdk.org> wrote:

> Dear community,
> may I please request reviews for this fix, improving the usefulness of method invocation counters.
> - aggregation counters are retyped as uint64_t, shifting the overflow probability way out (185 days in case of a 1 GHz counter update frequency).
> - counters for individual methods are interpreted as (unsigned int), in contrast to their declaration as int. This gives us a factor of two before the counters overflow.
> - as a special case, "compiled_invocation_counter" is retyped as long, because it has a higher update frequency than other counters.
> - before/after sample output is attached to the bug description. 
> 
> Thank you!
> Lutz

Changes requested by thartmann (Reviewer).

src/hotspot/share/oops/method.hpp line 728:

> 726: #ifndef PRODUCT
> 727:   static ByteSize compiled_invocation_counter_offset() { return byte_offset_of(Method, _compiled_invocation_count); }
> 728:   static ByteSize compiled_invocation_counter_offset64() { return byte_offset_of(Method, _compiled_invocation_count64); }

`compiled_invocation_counter_offset()` looks unused.

src/hotspot/share/oops/method.hpp line 459:

> 457: #else
> 458:   // for PrintMethodData in a product build
> 459:   int      compiled_invocation_count() const    { return 0; }

`compiled_invocation_count()` looks unused.

src/hotspot/share/oops/method.hpp line 106:

> 104:     struct {
> 105:       int     _compiled_invocation_count;  // Number of nmethod invocations so far (for perf. debugging)
> 106:                                            // Must preserve this as int. Is used outside the jdk by SA.

Why not update the SA code to access 64 bit?

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

PR: https://git.openjdk.java.net/jdk/pull/2511


More information about the hotspot-dev mailing list