8289745: JfrStructCopyFailed uses heap words instead of bytes for object sizes
Reviewed-by: mgronlun, stuefe
This commit is contained in:
parent
728157fa03
commit
7f0e9bd632
@ -163,9 +163,9 @@ void G1NewTracer::send_evacuation_failed_event(const EvacuationFailedInfo& ef_in
|
||||
// Create JFR structured failure data
|
||||
JfrStructCopyFailed evac_failed;
|
||||
evac_failed.set_objectCount(ef_info.failed_count());
|
||||
evac_failed.set_firstSize(ef_info.first_size());
|
||||
evac_failed.set_smallestSize(ef_info.smallest_size());
|
||||
evac_failed.set_totalSize(ef_info.total_size());
|
||||
evac_failed.set_firstSize(ef_info.first_size() * HeapWordSize);
|
||||
evac_failed.set_smallestSize(ef_info.smallest_size() * HeapWordSize);
|
||||
evac_failed.set_totalSize(ef_info.total_size() * HeapWordSize);
|
||||
// Add to the event
|
||||
e.set_gcId(GCId::current());
|
||||
e.set_evacuationFailed(evac_failed);
|
||||
|
@ -157,9 +157,9 @@ void OldGCTracer::send_old_gc_event() const {
|
||||
static JfrStructCopyFailed to_struct(const CopyFailedInfo& cf_info) {
|
||||
JfrStructCopyFailed failed_info;
|
||||
failed_info.set_objectCount(cf_info.failed_count());
|
||||
failed_info.set_firstSize(cf_info.first_size());
|
||||
failed_info.set_smallestSize(cf_info.smallest_size());
|
||||
failed_info.set_totalSize(cf_info.total_size());
|
||||
failed_info.set_firstSize(cf_info.first_size() * HeapWordSize);
|
||||
failed_info.set_smallestSize(cf_info.smallest_size() * HeapWordSize);
|
||||
failed_info.set_totalSize(cf_info.total_size() * HeapWordSize);
|
||||
return failed_info;
|
||||
}
|
||||
|
||||
|
@ -49,12 +49,16 @@ public class PromotionFailedEvent {
|
||||
// This test can not always trigger the expected event.
|
||||
// Test is ok even if no events found.
|
||||
List<RecordedEvent> events = RecordingFile.readAllEvents(Paths.get(jfr_file));
|
||||
int minObjectAlignment = 8;
|
||||
for (RecordedEvent event : events) {
|
||||
System.out.println("Event: " + event);
|
||||
long smallestSize = Events.assertField(event, "promotionFailed.smallestSize").atLeast(1L).getValue();
|
||||
Asserts.assertTrue((smallestSize % minObjectAlignment) == 0, "smallestSize " + smallestSize + " is not a valid size.");
|
||||
long firstSize = Events.assertField(event, "promotionFailed.firstSize").atLeast(smallestSize).getValue();
|
||||
Asserts.assertTrue((firstSize % minObjectAlignment) == 0, "firstSize " + firstSize + " is not a valid size.");
|
||||
long totalSize = Events.assertField(event, "promotionFailed.totalSize").atLeast(firstSize).getValue();
|
||||
long objectCount = Events.assertField(event, "promotionFailed.objectCount").atLeast(1L).getValue();
|
||||
Asserts.assertTrue((totalSize % minObjectAlignment) == 0, "totalSize " + totalSize + " is not a valid size.");
|
||||
Asserts.assertLessThanOrEqual(smallestSize * objectCount, totalSize, "smallestSize * objectCount <= totalSize");
|
||||
}
|
||||
}
|
||||
|
@ -76,13 +76,17 @@ public class TestEvacuationFailedEvent {
|
||||
|
||||
// Verify recording
|
||||
List<RecordedEvent> events = Events.fromRecording(recording);
|
||||
int minObjectAlignment = 8;
|
||||
|
||||
Events.hasEvents(events);
|
||||
for (RecordedEvent event : events) {
|
||||
long objectCount = Events.assertField(event, "evacuationFailed.objectCount").atLeast(1L).getValue();
|
||||
long smallestSize = Events.assertField(event, "evacuationFailed.smallestSize").atLeast(1L).getValue();
|
||||
Asserts.assertTrue((smallestSize % minObjectAlignment) == 0, "smallestSize " + smallestSize + " is not a valid size.");
|
||||
long firstSize = Events.assertField(event, "evacuationFailed.firstSize").atLeast(smallestSize).getValue();
|
||||
Asserts.assertTrue((firstSize % minObjectAlignment) == 0, "firstSize " + firstSize + " is not a valid size.");
|
||||
long totalSize = Events.assertField(event, "evacuationFailed.totalSize").atLeast(firstSize).getValue();
|
||||
Asserts.assertTrue((totalSize % minObjectAlignment) == 0, "totalSize " + totalSize + " is not a valid size.");
|
||||
Asserts.assertLessThanOrEqual(smallestSize * objectCount, totalSize, "smallestSize * objectCount <= totalSize");
|
||||
}
|
||||
recording.close();
|
||||
|
Loading…
Reference in New Issue
Block a user