Class CallMetrics
- java.lang.Object
-
- com.tonic.analysis.simulation.metrics.CallMetrics
-
public class CallMetrics extends Object
An immutable tally of the method calls seen during a simulation.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description CallMetricscombine(CallMetrics other)Sums every counter with another set of metrics.static CallMetricsempty()static CallMetricsfrom(MethodCallListener listener)Snapshots the counters a call listener accumulated.doublegetAverageCallsPerMethod()intgetDistinctMethods()intgetDynamicCalls()intgetInterfaceCalls()intgetPolymorphicCalls()intgetSpecialCalls()doublegetStaticCallPercentage()intgetStaticCalls()intgetTotalCalls()doublegetVirtualCallPercentage()intgetVirtualCalls()booleanhasCalls()StringtoString()
-
-
-
Method Detail
-
from
public static CallMetrics from(MethodCallListener listener)
Snapshots the counters a call listener accumulated.- Parameters:
listener- the listener to read- Returns:
- the metrics
-
empty
public static CallMetrics empty()
- Returns:
- metrics with every counter at zero
-
getTotalCalls
public int getTotalCalls()
- Returns:
- the total number of calls
-
getVirtualCalls
public int getVirtualCalls()
- Returns:
- the number of invokevirtual calls
-
getStaticCalls
public int getStaticCalls()
- Returns:
- the number of invokestatic calls
-
getInterfaceCalls
public int getInterfaceCalls()
- Returns:
- the number of invokeinterface calls
-
getSpecialCalls
public int getSpecialCalls()
- Returns:
- the number of invokespecial calls
-
getDynamicCalls
public int getDynamicCalls()
- Returns:
- the number of invokedynamic calls
-
getDistinctMethods
public int getDistinctMethods()
- Returns:
- the number of distinct methods called
-
getPolymorphicCalls
public int getPolymorphicCalls()
- Returns:
- virtual plus interface calls
-
getVirtualCallPercentage
public double getVirtualCallPercentage()
- Returns:
- virtual calls as a percentage of total calls, or 0 if there were none
-
getStaticCallPercentage
public double getStaticCallPercentage()
- Returns:
- static calls as a percentage of total calls, or 0 if there were none
-
hasCalls
public boolean hasCalls()
- Returns:
- true if at least one call was recorded
-
getAverageCallsPerMethod
public double getAverageCallsPerMethod()
- Returns:
- total calls divided by distinct methods, or 0 if no method was called
-
combine
public CallMetrics combine(CallMetrics other)
Sums every counter with another set of metrics.- Parameters:
other- the metrics to add- Returns:
- the combined metrics
-
-