On Wed, 4 Nov 2026 23:49:44 GMT, Serguei Spitsyn <[email protected]> wrote:
>> Shiv Shah has updated the pull request incrementally with one additional
>> commit since the last revision:
>>
>> Fail on fewer samples than expected
>
> test/hotspot/jtreg/serviceability/jvmti/HeapMonitor/MyPackage/HeapMonitorMultiArrayTest.java
> line 57:
>
>> 55: // Other allocations in the window get sampled too.
>> 56: if (!HeapMonitor.statsHaveExpectedNumberSamples(expectedNumber, 10))
>> {
>> 57: throw new RuntimeException("Number of samples (" + sampledEvents +
>> ") not within 10% of the expected ("
>
> Q: My understanding is that a number of samples below `expectedNumber` which
> `6000` will be acceptable. Should we make this check stronger and reject
> sample numbers below the `expectedNumber`?
>
> For instance:
>
> if (sampledEvents < expectedNumber ||
> !HeapMonitor.statsHaveExpectedNumberSamples(expectedNumber, 10)) {
> throw new RuntimeException("Number of samples (" + sampledEvents + ")
> not within 10% of the expected ("
> . . .
Good point. With interval 0 every one of these allocations gets sampled, and
all the failures we saw were above the expected count, so a lower bound is
right. Added as you suggested
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/33574#discussion_r4483297165