Class SimulationResult
- java.lang.Object
-
- com.tonic.analysis.simulation.core.SimulationResult
-
public final class SimulationResult extends Object
Immutable result of a simulation run.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classSimulationResult.BuilderMutable builder for SimulationResult instances.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static SimulationResult.Builderbuilder()Creates a new builder.List<StateSnapshot>getAllStates()intgetBlockCount()StateSnapshotgetEntryStateFor(IRBlock block)Gets the first state snapshot recorded for a block.StateSnapshotgetExitStateFor(IRBlock block)Gets the last state snapshot recorded for a block.intgetMaxStackDepth()IRMethodgetMethod()doublegetSimulationTimeMillis()longgetSimulationTimeNanos()StateSnapshotgetStateAt(int index)Gets the state snapshot at an index into the overall recording order.intgetStateCount()List<StateSnapshot>getStatesAt(IRBlock block)Gets the state snapshots recorded for a block.intgetTotalInstructions()booleanhasStates()StringtoString()
-
-
-
Method Detail
-
getMethod
public IRMethod getMethod()
- Returns:
- the method that was simulated
-
getAllStates
public List<StateSnapshot> getAllStates()
- Returns:
- all state snapshots recorded during simulation, in order
-
getStatesAt
public List<StateSnapshot> getStatesAt(IRBlock block)
Gets the state snapshots recorded for a block.- Parameters:
block- the block to look up- Returns:
- the block's snapshots, or an empty list when none were recorded
-
getStateAt
public StateSnapshot getStateAt(int index)
Gets the state snapshot at an index into the overall recording order.- Parameters:
index- the snapshot index- Returns:
- the snapshot, or null when the index is out of range
-
getEntryStateFor
public StateSnapshot getEntryStateFor(IRBlock block)
Gets the first state snapshot recorded for a block.- Parameters:
block- the block to look up- Returns:
- the block's entry snapshot, or null when none were recorded
-
getExitStateFor
public StateSnapshot getExitStateFor(IRBlock block)
Gets the last state snapshot recorded for a block.- Parameters:
block- the block to look up- Returns:
- the block's exit snapshot, or null when none were recorded
-
getTotalInstructions
public int getTotalInstructions()
- Returns:
- the total number of instructions simulated
-
getMaxStackDepth
public int getMaxStackDepth()
- Returns:
- the maximum stack depth observed during simulation
-
getSimulationTimeNanos
public long getSimulationTimeNanos()
- Returns:
- the simulation wall time in nanoseconds
-
getSimulationTimeMillis
public double getSimulationTimeMillis()
- Returns:
- the simulation wall time in milliseconds
-
getBlockCount
public int getBlockCount()
- Returns:
- the number of blocks with recorded states
-
getStateCount
public int getStateCount()
- Returns:
- the total number of state snapshots recorded
-
hasStates
public boolean hasStates()
- Returns:
- whether any state snapshots were recorded
-
builder
public static SimulationResult.Builder builder()
Creates a new builder.- Returns:
- an empty builder
-
-