RFR: JDK-8292072: NMT: repurpose Tracking overhead counter as global malloc counter [v2]
Thomas Stuefe
stuefe at openjdk.org
Fri Aug 12 07:27:07 UTC 2022
> I need a fast counter for global mallocs for [JDK-8291878](https://bugs.openjdk.org/browse/JDK-8291878). NMT does not keep a global counter, just category-specific counters. At the moment, `MallocMemorySummary::total()` iterates all these counters and adds them up, which is quite costly.
>
> This patch makes `MallocMemorySummary::total()` fast by introducing a global malloc counter. However, we don't add a new counter, we just repurpose the tracking overhead counter.
>
> The tracking overhead counter gets updated on every malloc and counts number and size of all malloc headers. But malloc headers have always the same size. This patch uses the former overhead counter to count number and size of all mallocs. So now we have a global malloc counter, at no additional cost, and the overhead gets calculated from the number of total mallocs * constant header size.
Thomas Stuefe has updated the pull request incrementally with one additional commit since the last revision:
Add NMT gtest to test malloc tracker totals
-------------
Changes:
- all: https://git.openjdk.org/jdk/pull/9804/files
- new: https://git.openjdk.org/jdk/pull/9804/files/34dfad49..a79bd533
Webrevs:
- full: https://webrevs.openjdk.org/?repo=jdk&pr=9804&range=01
- incr: https://webrevs.openjdk.org/?repo=jdk&pr=9804&range=00-01
Stats: 117 lines in 1 file changed: 117 ins; 0 del; 0 mod
Patch: https://git.openjdk.org/jdk/pull/9804.diff
Fetch: git fetch https://git.openjdk.org/jdk pull/9804/head:pull/9804
PR: https://git.openjdk.org/jdk/pull/9804
More information about the hotspot-runtime-dev
mailing list