Package org.jacoco.core.runtime
Class RuntimeData
- java.lang.Object
-
- org.jacoco.core.runtime.RuntimeData
-
public class RuntimeData extends java.lang.Object
Container for runtime execution and meta data. All access to the runtime data is thread safe.
-
-
Field Summary
Fields Modifier and Type Field Description protected ExecutionDataStore
store
store for execution data
-
Constructor Summary
Constructors Constructor Description RuntimeData()
Creates a new runtime.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
collect(IExecutionDataVisitor executionDataVisitor, ISessionInfoVisitor sessionInfoVisitor, boolean reset)
Collects the current execution data and writes it to the givenIExecutionDataVisitor
object.boolean
equals(java.lang.Object args)
In violation of the regular semantic ofObject.equals(Object)
this implementation is used as the interface to the execution data store.static void
generateAccessCall(long classid, java.lang.String classname, int probecount, org.objectweb.asm.MethodVisitor mv)
Generates the code that calls aRuntimeData
instance through the JRE API methodObject.equals(Object)
.static void
generateArgumentArray(long classid, java.lang.String classname, int probecount, org.objectweb.asm.MethodVisitor mv)
Generates code that creates the argument array for thegetProbes(Object[])
method.ExecutionData
getExecutionData(java.lang.Long id, java.lang.String name, int probecount)
Returns the coverage data for the class with the given identifier.void
getProbes(java.lang.Object[] args)
Retrieves the execution probe array for a given class.java.lang.String
getSessionId()
Get the current a session identifier for this runtime.void
reset()
Resets all coverage information.void
setSessionId(java.lang.String id)
Sets a session identifier for this runtime.
-
-
-
Field Detail
-
store
protected final ExecutionDataStore store
store for execution data
-
-
Method Detail
-
setSessionId
public void setSessionId(java.lang.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:
collect(IExecutionDataVisitor, ISessionInfoVisitor, boolean)
-
getSessionId
public java.lang.String getSessionId()
Get the current a session identifier for this runtime.- Returns:
- current session identifier
- See Also:
setSessionId(String)
-
collect
public final void collect(IExecutionDataVisitor executionDataVisitor, ISessionInfoVisitor sessionInfoVisitor, boolean reset)
Collects the current execution data and writes it to the givenIExecutionDataVisitor
object.- Parameters:
executionDataVisitor
- handler to write coverage data tosessionInfoVisitor
- handler to write session information toreset
- iftrue
the current coverage information is also cleared
-
reset
public final void reset()
Resets all coverage information.
-
getExecutionData
public ExecutionData getExecutionData(java.lang.Long id, java.lang.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 identifiername
- VM name of the classprobecount
- probe data length- Returns:
- execution data
-
getProbes
public void getProbes(java.lang.Object[] args)
Retrieves the execution probe array for a given class. The passedObject
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
)
- args[0]: probe array (
boolean[]
)
- Parameters:
args
- parameter array of length 3
- args[0]: class id (
-
equals
public boolean equals(java.lang.Object args)
In violation of the regular semantic ofObject.equals(Object)
this implementation is used as the interface to the execution data store.- Overrides:
equals
in classjava.lang.Object
- Parameters:
args
- the arguments as anObject
array- Returns:
- has no meaning
-
generateArgumentArray
public static void generateArgumentArray(long classid, java.lang.String classname, int probecount, org.objectweb.asm.MethodVisitor mv)
Generates code that creates the argument array for thegetProbes(Object[])
method. The array instance is left on the operand stack. The generated code requires a stack size of 5.- Parameters:
classid
- class identifierclassname
- VM class nameprobecount
- probe count for this classmv
- visitor to emit generated code
-
generateAccessCall
public static void generateAccessCall(long classid, java.lang.String classname, int probecount, org.objectweb.asm.MethodVisitor mv)
Generates the code that calls aRuntimeData
instance through the JRE API methodObject.equals(Object)
. The code pops aObject
instance from the stack and pushes the probe array of typeboolean[]
on the operand stack. The generated code requires a stack size of 6.- Parameters:
classid
- class identifierclassname
- VM class nameprobecount
- probe count for this classmv
- visitor to emit generated code
-
-