org.jacoco.core.runtime
Interface IRuntime

All Known Implementing Classes:
AbstractRuntime, LoggerRuntime, SystemPropertiesRuntime

public interface IRuntime

This interface represents a particular mechanism to collect execution information in the target VM at runtime.

Version:
$Revision: $
Author:
Marc R. Hoffmann

Method Summary
 void collect(IExecutionDataVisitor visitor, boolean reset)
          Collects the current execution data and writes it to the given IExecutionDataVisitor object.
 int generateDataAccessor(long classid, GeneratorAdapter gen)
          This method generates the byte code required to obtain the coverage data structure for the class with the given id.
 void registerClass(long classid, String name, boolean[] data)
          Before a particular class gets loaded, its execution data structure must be registered with the runtime through this method.
 void reset()
          Resets all coverage information.
 void shutdown()
          Allows the coverage runtime to cleanup internals.
 void startup()
          Starts the coverage runtime.
 

Method Detail

generateDataAccessor

int generateDataAccessor(long classid,
                         GeneratorAdapter gen)
This method generates the byte code required to obtain the coverage data structure for the class with the given id. Typically the instrumentation process will embed this code into a method that is called on class initialization. This method can be called at any time even outside the target VM. The generated code must push a byte[][] instance to the operand stack. Except this result object the generated code must not make any assumptions about the structure of the embedding method or class.

Parameters:
classid - identifier of the class
gen - code output
Returns:
additional stack size required by the implementation, including the instance pushed to the stack

startup

void startup()
Starts the coverage runtime. This method MUST be called before any class instrumented for this runtime is loaded.


shutdown

void shutdown()
Allows the coverage runtime to cleanup internals. This class should be called when classes instrumented for this runtime are not used any more.


registerClass

void registerClass(long classid,
                   String name,
                   boolean[] data)
Before a particular class gets loaded, its execution data structure must be registered with the runtime through this method. This method must only be called between startup() and shutdown().

Parameters:
classid - identifier of the class
name - VM name of the class
data - execution data structure for this class

collect

void collect(IExecutionDataVisitor visitor,
             boolean reset)
Collects the current execution data and writes it to the given IExecutionDataVisitor object. This method must only be called between startup() and shutdown().

Parameters:
visitor - handler to write coverage data to
reset - if true the current coverage information is also cleared

reset

void reset()
Resets all coverage information. This method must only be called between startup() and shutdown().