org.jacoco.core.runtime
Class LoggerRuntime

java.lang.Object
  extended by org.jacoco.core.runtime.AbstractRuntime
      extended by org.jacoco.core.runtime.LoggerRuntime
All Implemented Interfaces:
IExecutionDataAccessorGenerator, IRuntime

public class LoggerRuntime
extends AbstractRuntime

This IRuntime implementation uses the Java logging API to report coverage data.

The implementation uses a dedicated log channel. Instrumented classes call Logger.log(Level, String, Object[]) with the class identifier in the first slot of the parameter array. The runtime implements a Handler for this channel that puts the probe data structure into the first slot of the parameter array.


Field Summary
 
Fields inherited from class org.jacoco.core.runtime.AbstractRuntime
access, store
 
Constructor Summary
LoggerRuntime()
          Creates a new runtime.
 
Method Summary
 int generateDataAccessor(long classid, String classname, int probecount, MethodVisitor mv)
          This method generates the byte code required to obtain the coverage data structure for the class with the given id.
 void shutdown()
          Allows the coverage runtime to cleanup internals.
 void startup()
          Starts the coverage runtime.
 
Methods inherited from class org.jacoco.core.runtime.AbstractRuntime
collect, getSessionId, reset, setSessionId, setStartTimeStamp
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LoggerRuntime

public LoggerRuntime()
Creates a new runtime.

Method Detail

generateDataAccessor

public int generateDataAccessor(long classid,
                                String classname,
                                int probecount,
                                MethodVisitor mv)
Description copied from interface: IExecutionDataAccessorGenerator
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 boolean[] 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. The generated code must not use or allocate local variables.

Parameters:
classid - identifier of the class
classname - VM class name
probecount - probe count for this class
mv - code output
Returns:
additional stack size required by the implementation, including the instance pushed to the stack

startup

public void startup()
Description copied from interface: IRuntime
Starts the coverage runtime. This method MUST be called before any class instrumented for this runtime is loaded.


shutdown

public void shutdown()
Description copied from interface: IRuntime
Allows the coverage runtime to cleanup internals. This class should be called when classes instrumented for this runtime are not used any more.