com.jrockit.mc.flightrecorder
Class FlightRecording

java.lang.Object
  extended by com.jrockit.mc.flightrecorder.FlightRecording
All Implemented Interfaces:
java.lang.Iterable<IEvent>

public final class FlightRecording
extends java.lang.Object
implements java.lang.Iterable<IEvent>

The main class for accessing flight recorder events.

See code snippet below for how to open up a recording file and print the start time and the event type of all events using the default file provider.
 FlightRecording recording = FlightRecording.createFromFile(new File("recording.jfr"));
 for (IEvent event : recording)
 {
        System.out.println(new Date(event.getStartTimestamp() / (1000 * 1000)) + " " + event.getEventType().getName());
 }
 

Author:
Erik Gahlin

Constructor Summary
FlightRecording()
          Creates an empty flight recording.
FlightRecording(Provider provider)
          Create a flight recording using a provider class as back-end.
 
Method Summary
static FlightRecording createFromFile(java.io.File file)
          Creates a flight recording using the default file provider.
 IView createView()
          Returns a view of the recording data.
 java.util.Collection<IEventType> getEventTypes()
          Returns the event types for all the producers in the repository.
 java.util.Collection<IProducer> getProducers()
          Return the producers in the recording.
 ITrackGroup getRootGroup()
          Returns the top node for all tracks.
 ITimeRange getTimeRange()
          Returns the time range the recording spans.
 java.util.Iterator<IEvent> iterator()
          Returns an iterator over all the events available in the recording.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FlightRecording

public FlightRecording()
Creates an empty flight recording. See createFromFile(File) for how to create a recording from a file.


FlightRecording

public FlightRecording(Provider provider)
Create a flight recording using a provider class as back-end. See createFromFile(File) for how to create from a file using the default file provider.

Parameters:
provider - the back-end provider.
Method Detail

createFromFile

public static FlightRecording createFromFile(java.io.File file)
Creates a flight recording using the default file provider.

Parameters:
file - the recording file
Returns:
a flight recording.

getTimeRange

public ITimeRange getTimeRange()
Returns the time range the recording spans. The range starts where the first event begins and stops where the last ends. The range is in nanoseconds.

Returns:
the range for the recording

createView

public IView createView()
Returns a view of the recording data. A view is used to setup how events should be extracted.

Returns:
a view

iterator

public java.util.Iterator<IEvent> iterator()
Returns an iterator over all the events available in the recording. The order the events are returned is undefined.

Specified by:
iterator in interface java.lang.Iterable<IEvent>
Returns:
an event iterator

getEventTypes

public java.util.Collection<IEventType> getEventTypes()
Returns the event types for all the producers in the repository. The returned collection is immutable.

Returns:
an immutable collection of then event types in the repository

getProducers

public java.util.Collection<IProducer> getProducers()
Return the producers in the recording.

Returns:
a collection of producers

getRootGroup

public ITrackGroup getRootGroup()
Returns the top node for all tracks.

Returns:
the root group


Copyright © 1999, 2011, Oracle and/or its affiliates. All rights reserved.