Skip to content

Commit cc1c427

Browse files
committed
8380755: jdk/jfr/event/gc/heapsummary/TestHeapSummaryEventG1.java fails gcId should be increasing
Reviewed-by: dholmes, mgronlun
1 parent 28a91d0 commit cc1c427

2 files changed

Lines changed: 18 additions & 3 deletions

File tree

test/jdk/jdk/jfr/event/gc/heapsummary/HeapSummaryEventAllGcs.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2013, 2025, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2013, 2026, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -48,7 +48,7 @@ public static void test(String expectedYoungCollector, String expectedOldCollect
4848
GCHelper.callSystemGc(5, true);
4949
recording.stop();
5050

51-
List<RecordedEvent> allEvents = Events.fromRecording(recording);
51+
List<RecordedEvent> allEvents = Events.fromRecordingOrdered(recording);
5252
if (!checkCollectors(allEvents, expectedYoungCollector, expectedOldCollector)) {
5353
return;
5454
}

test/lib/jdk/test/lib/jfr/Events.java

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2013, 2025, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2013, 2026, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -33,6 +33,7 @@
3333
import java.nio.file.Path;
3434
import java.time.Duration;
3535
import java.time.Instant;
36+
import java.util.Comparator;
3637
import java.util.List;
3738

3839
import jdk.jfr.AnnotationElement;
@@ -280,6 +281,20 @@ public static List<RecordedEvent> fromRecording(Recording recording) throws IOEx
280281
return RecordingFile.readAllEvents(makeCopy(recording));
281282
}
282283

284+
/**
285+
* Creates a list of events from a recording, ordered by the end time.
286+
*
287+
* @param recording recording, not {@code null}
288+
* @return a list, not null
289+
* @throws IOException if an event set could not be created due to I/O
290+
* errors.
291+
*/
292+
public static List<RecordedEvent> fromRecordingOrdered(Recording recording) throws IOException {
293+
List<RecordedEvent> events = fromRecording(recording);
294+
events.sort(Comparator.comparing(RecordedEvent::getEndTime));
295+
return events;
296+
}
297+
283298
public static RecordingFile copyTo(Recording r) throws IOException {
284299
return new RecordingFile(makeCopy(r));
285300
}

0 commit comments

Comments
 (0)