Class TraceFile

java.lang.Object
com.ibm.jvm.trace.TraceFile

public class TraceFile extends Object
  • Constructor Details

    • TraceFile

      public TraceFile(String traceFileNameURI)
      Create a TraceFile object for a binary trace file.
      Parameters:
      traceFileNameURI - a URI of the binary trace file to open and format.
    • TraceFile

      public TraceFile()
      Create an empty TraceFile object to which TraceBuffers and a TraceFileHeader can be added.
  • Method Details

    • addTraceBuffer

      public boolean addTraceBuffer(byte[] traceBuffer) throws com.ibm.jvm.trace.InvalidTraceBufferException
      Add a byte representation of a binary trace buffer to the current TraceFile.
      Parameters:
      traceBuffer - an array of bytes containing the traceBuffer to be added. The traceBuffer must have the precise length of the complete traceBuffer, and the traceBuffer must be exactly as generated by the trace engine of an IBM Java VM. The byte array must not contain any padding.
      Returns:
      true on success, false on failure to add the buffer to the current TraceFile.
      Throws:
      com.ibm.jvm.trace.InvalidTraceBufferException - if the byte array does not contain a valid binary trace buffer.
    • addTraceFileHeader

      public boolean addTraceFileHeader(byte[] traceFileHeader) throws com.ibm.jvm.trace.InvalidTraceFileHeaderException
      Add a binary representation of a TraceFileHeader to the current TraceFile.
      Parameters:
      traceFileHeader - a byte array containing precisely a TraceFileHeader as generated by the IBM Java VM trace engine. The byte array must not contain any padding.
      Returns:
      true if the header is added, false if a header has already been added.
      Throws:
      com.ibm.jvm.trace.InvalidTraceFileHeaderException - if the byte array does not contain a valid binary trace file header.
    • getHeaderInfo

      public TraceFileHeader getHeaderInfo()
      Get the object representation of the current TraceFile's TraceFileHeader
      Returns:
      a TraceFileHeader object representing the current TraceFile's TraceFileHeader, or null if the current TraceFile does not contain a valid TraceFileHeader.
    • getTraceThreads

      public TraceThread[] getTraceThreads()
      Get an array representing all of the traced threads in the current TraceFile.
      Returns:
      an array of TraceThread objects, containing one TraceThread object per thread found in the current TraceFile, or null if the current TraceFile does not contain any traced threads.
    • getGlobalChronologicalTracePointIterator

      public Iterator getGlobalChronologicalTracePointIterator()
      Get a TracePoint Iterator for the current TraceFile.
      Returns:
      an Iterator that can be used to walk every TracePoint in the current TraceFile in chronological order. The iterator can be used a single time only, since it consumes the data as it walks it. Requesting an Iterator for a consumed TraceFile with return an empty Iterator. An empty Iterator will also be returned in cases where the current TraceFile does not contain any TracePoints.
    • getNextTracePoint

      public TracePoint getNextTracePoint()
      Get a tracepoint from the trace file.
      Returns:
      the next trace point for this file.