RFR: 8307488: Incorrect weight of the first ObjectAllocationSample JFR event [v2]

Aleksey Shipilev shade at openjdk.org
Tue May 30 10:45:05 UTC 2023


On Tue, 30 May 2023 10:31:09 GMT, Markus Grönlund <mgronlun at openjdk.org> wrote:

>> src/hotspot/share/jfr/recorder/service/jfrRecorderService.cpp line 146:
>> 
>>> 144:   iterate(jit, coas);
>>> 145:   JfrNonJavaThreadIterator njit;
>>> 146:   iterate(njit, coas);
>> 
>> Apologies for the post-integration review, but I have a question/suggestion. This code retains the JavaThread iterator while NonJavaThreadIterator is running, which feels unnecessary. Also, if we have thousands of threads, walking these threads and doing the unconditional `clear_last_allocated_bytes` there seems redundant and heavy-weight if the relevant JFR event is off.
>
> At this point, no recording is running, and no event settings are applied. No state exists to know if the event was enabled when the previous, last recording stopped.

OK, that's unfortunate. 

I would still suggest to split the scopes for Java and non-Java iterators. And maybe check if `last_allocated_bytes` is not zero (which is a rare case, especially when event is disabled) before clearing, thus replacing the unconditional write with conditional read-write.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/14158#discussion_r1210086140


More information about the hotspot-jfr-dev mailing list