Class CallMetrics


  • public class CallMetrics
    extends Object
    An immutable tally of the method calls seen during a simulation.
    • 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