Class RuntimeData

java.lang.Object
org.jacoco.core.runtime.RuntimeData

public class RuntimeData extends Object
Container for runtime execution and meta data. All access to the runtime data is thread safe.
  • Field Details

    • store

      protected final ExecutionDataStore store
      store for execution data
    • startTimeStamp

      private long startTimeStamp
    • sessionId

      private String sessionId
  • Constructor Details

    • RuntimeData

      public RuntimeData()
      Creates a new runtime.
  • Method Details

    • setSessionId

      public void setSessionId(String id)
      Sets a session identifier for this runtime. The identifier is used when execution data is collected. If no identifier is explicitly set a identifier is generated from the host name and a random number. This method can be called at any time.
      Parameters:
      id - new session identifier
      See Also:
    • getSessionId

      public String getSessionId()
      Get the current a session identifier for this runtime.
      Returns:
      current session identifier
      See Also:
    • collect

      public final void collect(IExecutionDataVisitor executionDataVisitor, ISessionInfoVisitor sessionInfoVisitor, boolean reset)
      Collects the current execution data and writes it to the given IExecutionDataVisitor object.
      Parameters:
      executionDataVisitor - handler to write coverage data to
      sessionInfoVisitor - handler to write session information to
      reset - if true the current coverage information is also cleared
    • reset

      public final void reset()
      Resets all coverage information.
    • getExecutionData

      public ExecutionData getExecutionData(Long id, String name, int probecount)
      Returns the coverage data for the class with the given identifier. If there is no data available under the given id a new entry is created. This is a synchronized access to the underlying store.
      Parameters:
      id - class identifier
      name - VM name of the class
      probecount - probe data length
      Returns:
      execution data
    • getProbes

      public void getProbes(Object[] args)
      Retrieves the execution probe array for a given class. The passed Object array instance is used for parameters and the return value as follows. Call parameters:
      • args[0]: class id (Long)
      • args[1]: vm class name (String)
      • args[2]: probe count (Integer)
      Return value:
      • args[0]: probe array (boolean[])
      Parameters:
      args - parameter array of length 3
    • equals

      public boolean equals(Object args)
      In violation of the regular semantic of Object.equals(Object) this implementation is used as the interface to the execution data store.
      Overrides:
      equals in class Object
      Parameters:
      args - the arguments as an Object array
      Returns:
      has no meaning
    • generateArgumentArray

      public static void generateArgumentArray(long classid, String classname, int probecount, org.objectweb.asm.MethodVisitor mv)
      Generates code that creates the argument array for the getProbes(Object[]) method. The array instance is left on the operand stack. The generated code requires a stack size of 5.
      Parameters:
      classid - class identifier
      classname - VM class name
      probecount - probe count for this class
      mv - visitor to emit generated code
    • generateAccessCall

      public static void generateAccessCall(long classid, String classname, int probecount, org.objectweb.asm.MethodVisitor mv)
      Generates the code that calls a RuntimeData instance through the JRE API method Object.equals(Object). The code pops a Object instance from the stack and pushes the probe array of type boolean[] on the operand stack. The generated code requires a stack size of 6.
      Parameters:
      classid - class identifier
      classname - VM class name
      probecount - probe count for this class
      mv - visitor to emit generated code