RFR: 7903572: JMH: mempool should capture Direct/Mapped memory pools as well
Aleksey Shipilev
shade at openjdk.org
Fri Oct 20 16:30:12 UTC 2023
On Tue, 10 Oct 2023 05:09:55 GMT, Alexey Vinogradov <duke at openjdk.org> wrote:
> In this PR I am adding the support for Direct/Mapped Memory pools in the `MemPoolProfiler`.
> In my case, it was needed because I suppose a memory leak in the third-party library that unmaps `MappedByteBuffer`.
The idea looks fine, we need a few adjustments though:
Looks okay to me. Let's wait for OCA to clear.
Can you post the sample output for this profiler?
jmh-core/src/main/java/org/openjdk/jmh/profile/MemPoolProfiler.java line 72:
> 70: final long used = bean.getMemoryUsed();
> 71: sum += used;
> 72: results.add(new ScalarResult(String.format("mempool.%s.used", bean.getName()), used / BYTES_PER_KIB, "KiB", AggregationPolicy.MAX));
Please match the style of the for-loop above:
- drop `final` from `used`;
- use regular concat instead of String.format;
jmh-core/src/main/java/org/openjdk/jmh/profile/MemPoolProfiler.java line 74:
> 72: results.add(new ScalarResult("mempool.total.used", sum / BYTES_PER_KIB, "KiB", AggregationPolicy.MAX));
> 73:
> 74: results.addAll(
These need to be added to `mempool.total.used`. Also, rewrite it in the same style as existing code, without streams.
jmh-core/src/main/java/org/openjdk/jmh/profile/MemPoolProfiler.java line 77:
> 75: results.add(new ScalarResult("mempool.total.codeheap.used", sumCodeHeap / BYTES_PER_KIB, "KiB", AggregationPolicy.MAX));
> 76: results.add(new ScalarResult("mempool.total.used", sum / BYTES_PER_KIB, "KiB", AggregationPolicy.MAX));
> 77:
No newline is needed here.
-------------
Changes requested by shade (Committer).
PR Review: https://git.openjdk.org/jmh/pull/124#pullrequestreview-1670399887
Marked as reviewed by shade (Committer).
PR Review: https://git.openjdk.org/jmh/pull/124#pullrequestreview-1670738428
PR Review Comment: https://git.openjdk.org/jmh/pull/124#discussion_r1354633107
PR Review Comment: https://git.openjdk.org/jmh/pull/124#discussion_r1354417255
PR Review Comment: https://git.openjdk.org/jmh/pull/124#discussion_r1354632083
More information about the jmh-dev
mailing list