private static class OrienteeringSelection.SequenceDetails
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private long |
executionTimeNanos
The execution time of the sequence, in nanoseconds.
|
private double |
methodSizeSqrt
The square root of the number of method calls in the sequence.
|
private int |
selectionCount
Number of times this sequence has been selected by
OrienteeringSelection . |
private double |
weight
A
Sequence 's weight. |
Constructor and Description |
---|
SequenceDetails(double methodSizeSqrt,
long executionTimeNanos)
Create a SequenceDetails.
|
SequenceDetails(Sequence sequence,
long executionTimeNanos)
Create a SequenceDetails for the given sequence, but using the given execution time.
|
Modifier and Type | Method and Description |
---|---|
double |
getWeight()
Returns the weight of the sequence.
|
void |
incrementSelectionCount()
Increments the selection count.
|
private void |
updateWeight()
Compute the weight of a sequence.
|
private final double methodSizeSqrt
private final long executionTimeNanos
private int selectionCount
OrienteeringSelection
.private double weight
Sequence
's weight. This is computed from the other fields and is updated when
selectionCount
is.SequenceDetails(Sequence sequence, long executionTimeNanos)
sequence
- a sequenceexecutionTimeNanos
- execution time in nanosecondspublic SequenceDetails(double methodSizeSqrt, long executionTimeNanos)
methodSizeSqrt
- the square root of the number of method callsexecutionTimeNanos
- the execution time, in nanosecondspublic void incrementSelectionCount()
public double getWeight()
private void updateWeight()
1.0 / (k * seq.exec_time * sqrt(seq.meth_size))
where k is the number of selections of seq and exec_time is the execution time of seq and meth_size is the number of method call statements in seq. This formula is a slight simplification of the one described in the GRT paper which maintains a separate exec_time for each execution of seq. However, we assume that every execution time for a sequence is the same as the first execution.