com/oracle/jfr/gc/TestYoungGarbageCollectionEvent.java
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File closed Sdiff com/oracle/jfr/gc

com/oracle/jfr/gc/TestYoungGarbageCollectionEvent.java

Print this page
rev 1475 : 8010090: GC ID has the wrong type
Summary: GC ID changed from ulong to uint
Reviewed-by: mattias.tobiasson@oracle.com


  22  * @run main/othervm -XX:+UnlockCommercialFeatures -XX:+FlightRecorder -Xmx50m -Xmn2m -XX:+UseG1GC -XX:+UnlockExperimentalVMOptions -XX:-UseFastUnorderedTimeStamps TestYoungGarbageCollectionEvent G1New
  23  */
  24 public class TestYoungGarbageCollectionEvent {
  25     private static final int UNSET_TIMESTAMP = -1;
  26     private static final String youngGCEvent = "vm/gc/collector/young_garbage_collection";
  27 
  28     public static void main(String[] args) throws Exception {
  29         TestRecording r = new TestRecording();
  30         try {
  31             enableEvent(r, youngGCEvent);
  32 
  33             r.start();
  34             triggerGC();
  35             r.stop();
  36 
  37             List<FLREvent> allEvents = getEventsFromRecording(r, ".*");
  38             List<FLREvent> ycEvents = selectEventsWithPath(allEvents, youngGCEvent);
  39             assertFalse(ycEvents.isEmpty(), "ycEvents must not be empty");
  40 
  41             for (FLREvent e : ycEvents) {
  42                 Long gcId = (Long) e.getValue("gcId");
  43                 assertNE(gcId, -1, "Expected a valid GC id");
  44 
  45                 Integer tenuringThreshold = (Integer) e.getValue("tenuringThreshold");
  46                 assertGT(tenuringThreshold, 0, "Expected tenuring threshold to be larger than 0");
  47 
  48                 Long startTime = e.getStartTime();
  49                 Long endTime = e.getTimestamp();
  50 
  51                 assertNE(startTime, UNSET_TIMESTAMP, "Expected start time of event to be defined");
  52                 assertNE(endTime, UNSET_TIMESTAMP, "Expected end time of event to be defined");
  53                 assertGT(endTime, startTime, "Expected the end time of the event to be later than the start time");
  54             }
  55         } catch (Throwable t) {
  56             r.copyTo("TestYoungGarbageCollectionEvent.jfr");
  57             throw t;
  58         } finally {
  59             r.close();
  60         }
  61     }
  62 




  22  * @run main/othervm -XX:+UnlockCommercialFeatures -XX:+FlightRecorder -Xmx50m -Xmn2m -XX:+UseG1GC -XX:+UnlockExperimentalVMOptions -XX:-UseFastUnorderedTimeStamps TestYoungGarbageCollectionEvent G1New
  23  */
  24 public class TestYoungGarbageCollectionEvent {
  25     private static final int UNSET_TIMESTAMP = -1;
  26     private static final String youngGCEvent = "vm/gc/collector/young_garbage_collection";
  27 
  28     public static void main(String[] args) throws Exception {
  29         TestRecording r = new TestRecording();
  30         try {
  31             enableEvent(r, youngGCEvent);
  32 
  33             r.start();
  34             triggerGC();
  35             r.stop();
  36 
  37             List<FLREvent> allEvents = getEventsFromRecording(r, ".*");
  38             List<FLREvent> ycEvents = selectEventsWithPath(allEvents, youngGCEvent);
  39             assertFalse(ycEvents.isEmpty(), "ycEvents must not be empty");
  40 
  41             for (FLREvent e : ycEvents) {
  42                 Integer gcId = (Integer) e.getValue("gcId");
  43                 assertNE(gcId, -1, "Expected a valid GC id");
  44 
  45                 Integer tenuringThreshold = (Integer) e.getValue("tenuringThreshold");
  46                 assertGT(tenuringThreshold, 0, "Expected tenuring threshold to be larger than 0");
  47 
  48                 Long startTime = e.getStartTime();
  49                 Long endTime = e.getTimestamp();
  50 
  51                 assertNE(startTime, UNSET_TIMESTAMP, "Expected start time of event to be defined");
  52                 assertNE(endTime, UNSET_TIMESTAMP, "Expected end time of event to be defined");
  53                 assertGT(endTime, startTime, "Expected the end time of the event to be later than the start time");
  54             }
  55         } catch (Throwable t) {
  56             r.copyTo("TestYoungGarbageCollectionEvent.jfr");
  57             throw t;
  58         } finally {
  59             r.close();
  60         }
  61     }
  62 


com/oracle/jfr/gc/TestYoungGarbageCollectionEvent.java
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File