8301641: NativeMemoryUsageTotal event uses reserved value for committed field
Reviewed-by: eosterlund, stefank
This commit is contained in:
parent
1aaf394b33
commit
77dbcd8569
@ -115,7 +115,7 @@ size_t NMTUsage::total_reserved() const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
size_t NMTUsage::total_committed() const {
|
size_t NMTUsage::total_committed() const {
|
||||||
return _malloc_total + _vm_total.reserved;
|
return _malloc_total + _vm_total.committed;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t NMTUsage::reserved(MEMFLAGS flag) const {
|
size_t NMTUsage::reserved(MEMFLAGS flag) const {
|
||||||
|
@ -147,6 +147,17 @@ public class TestNativeMemoryUsageEvents {
|
|||||||
assertGreaterThan(lastSample, firstSample, "heap should have grown and NMT should show that");
|
assertGreaterThan(lastSample, firstSample, "heap should have grown and NMT should show that");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static void verifyTotalDiffBetweenReservedAndCommitted(List<RecordedEvent> events) throws Exception {
|
||||||
|
RecordedEvent firstTotal = events.stream()
|
||||||
|
.filter(e -> e.getEventType().getName().equals(UsageTotalEvent))
|
||||||
|
.findFirst().orElse(null);
|
||||||
|
|
||||||
|
// Verify that the first total event has more reserved than committed memory.
|
||||||
|
long firstReserved = firstTotal.getLong("reserved");
|
||||||
|
long firstCommitted = firstTotal.getLong("committed");
|
||||||
|
assertGreaterThan(firstReserved, firstCommitted, "initial reserved should be greater than initial committed");
|
||||||
|
}
|
||||||
|
|
||||||
private static void verifyNoUsageEvents(List<RecordedEvent> events) throws Exception {
|
private static void verifyNoUsageEvents(List<RecordedEvent> events) throws Exception {
|
||||||
Events.hasNotEvent(events, UsageEvent);
|
Events.hasNotEvent(events, UsageEvent);
|
||||||
Events.hasNotEvent(events, UsageTotalEvent);
|
Events.hasNotEvent(events, UsageTotalEvent);
|
||||||
@ -167,6 +178,7 @@ public class TestNativeMemoryUsageEvents {
|
|||||||
if (nmtEnabled) {
|
if (nmtEnabled) {
|
||||||
verifyExpectedEventTypes(events);
|
verifyExpectedEventTypes(events);
|
||||||
verifyHeapGrowth(events);
|
verifyHeapGrowth(events);
|
||||||
|
verifyTotalDiffBetweenReservedAndCommitted(events);
|
||||||
} else {
|
} else {
|
||||||
verifyNoUsageEvents(events);
|
verifyNoUsageEvents(events);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user