src/jdk.jfr/share/classes/jdk/jfr/FlightRecorder.java
changeset 50745 a390cbb82d47
parent 50113 caf115bb98ad
equal deleted inserted replaced
50744:6c306d54366d 50745:a390cbb82d47
    32 import java.security.AccessControlContext;
    32 import java.security.AccessControlContext;
    33 import java.security.AccessController;
    33 import java.security.AccessController;
    34 import java.util.ArrayList;
    34 import java.util.ArrayList;
    35 import java.util.Collections;
    35 import java.util.Collections;
    36 import java.util.List;
    36 import java.util.List;
    37 import java.util.Map;
       
    38 import java.util.Objects;
    37 import java.util.Objects;
    39 
    38 
    40 import jdk.jfr.internal.JVM;
    39 import jdk.jfr.internal.JVM;
    41 import jdk.jfr.internal.JVMSupport;
    40 import jdk.jfr.internal.JVMSupport;
    42 import jdk.jfr.internal.LogLevel;
    41 import jdk.jfr.internal.LogLevel;
    75      *
    74      *
    76      * @return a list of recordings, not {@code null}
    75      * @return a list of recordings, not {@code null}
    77      */
    76      */
    78     public List<Recording> getRecordings() {
    77     public List<Recording> getRecordings() {
    79         List<Recording> recs = new ArrayList<>();
    78         List<Recording> recs = new ArrayList<>();
    80         for (PlatformRecording internal : internal.getRecordings()) {
    79         for (PlatformRecording r : internal.getRecordings()) {
    81             recs.add(internal.getRecording());
    80             recs.add(r.getRecording());
    82         }
    81         }
    83         return Collections.unmodifiableList(recs);
    82         return Collections.unmodifiableList(recs);
    84     }
    83     }
    85 
    84 
    86     /**
    85     /**
   110      * needed.
   109      * needed.
   111      *
   110      *
   112      * @return a snapshot of all available recording data, not {@code null}
   111      * @return a snapshot of all available recording data, not {@code null}
   113      */
   112      */
   114     public Recording takeSnapshot() {
   113     public Recording takeSnapshot() {
   115         return internal.newSnapshot();
   114         Recording snapshot = new Recording();
       
   115         snapshot.setName("Snapshot");
       
   116         internal.fillWithRecordedData(snapshot.getInternal(), null);
       
   117         return snapshot;
   116     }
   118     }
   117 
   119 
   118     /**
   120     /**
   119      * Registers an event class.
   121      * Registers an event class.
   120      * <p>
   122      * <p>
   343      */
   345      */
   344     public static boolean isInitialized() {
   346     public static boolean isInitialized() {
   345         return initialized;
   347         return initialized;
   346     }
   348     }
   347 
   349 
   348     // package private
   350     PlatformRecorder getInternal() {
   349     PlatformRecording newInternalRecording(Map<String, String> settings) {
   351         return internal;
   350         return internal.newRecording(settings);
   352     }
   351     }
       
   352 
       
   353 }
   353 }