Class MethodProfilingRule

  • All Implemented Interfaces:
    IRule

    public class MethodProfilingRule
    extends java.lang.Object
    implements IRule
    Rule that calculates the top method balance in a sliding window throughout the recording with a relevance calculated by the ratio of samples to maximum samples for that period.
    • Field Detail

      • SAMPLES_PER_PERIOD

        private static final double SAMPLES_PER_PERIOD
        Constant value of the maximum number of samples the JVM attempts per sampling period.
        See Also:
        Constant Field Values
      • MAX_STACK_DEPTH

        private static final int MAX_STACK_DEPTH
        Constant value of the maximum number of stack frames to display for the hottest path.
        See Also:
        Constant Field Values
      • EXCLUDED_PACKAGE_REGEXP

        public static final TypedPreference<java.lang.String> EXCLUDED_PACKAGE_REGEXP
      • CONFIG_ATTRIBUTES

        private static final java.util.List<TypedPreference<?>> CONFIG_ATTRIBUTES
    • Constructor Detail

      • MethodProfilingRule

        public MethodProfilingRule()
    • Method Detail

      • evaluate

        public java.util.concurrent.RunnableFuture<Result> evaluate​(IItemCollection items,
                                                                    IPreferenceValueProvider valueProvider)
        Description copied from interface: IRule
        Gets a future representing the result of the evaluation of this rule. Running the RunnableFuture is the responsibility of the caller of this method, not the implementation.
        Specified by:
        evaluate in interface IRule
        Parameters:
        items - items to evaluate
        valueProvider - Provider of configuration values used for evaluation. The attributes that will be asked for from the provider should be provided by IRule.getConfigurationAttributes().
        Returns:
        a RunnableFuture that when run will return the evaluation result
      • performSigmoidMap

        private double performSigmoidMap​(double input)
      • createWindowVisitor

        private SlidingWindowToolkit.IUnorderedWindowVisitor createWindowVisitor​(MethodProfilingRule.PeriodRangeMap settings,
                                                                                 IItemFilter settingsFilter,
                                                                                 IQuantity windowSize,
                                                                                 java.util.List<MethodProfilingRule.MethodProfilingWindowResult> rawScores,
                                                                                 java.util.concurrent.FutureTask<Result> evaluationTask,
                                                                                 java.util.regex.Pattern excludes)
        Creates an IUnorderedWindowVisitor that is called on each slice in the recording and generates the scores for each slice and places them in the rawScores list. The given parameters that are also given to the slidingWindowUnordered call must be the same as in this call.
        Parameters:
        settings - the settings map with all the times the execution sample event has a change of periodicity
        settingsFilter - the filter used to select the recording setting for the execution sample event
        windowSize - the size of the sliding window
        rawScores - the list of raw scores that will be populated by this visitor
        Returns:
        an IUnorderedWindowVisitor implementation that will populate the rawScores list with raw score values
      • populateSettingsMap

        private void populateSettingsMap​(IItemCollection items,
                                         MethodProfilingRule.PeriodRangeMap settings)
        Populates the settings map with all the period settings for the execution sample event found in this recording.
        Parameters:
        items - the items to search for execution sample period events
        settings - the map to populate with the events
      • getValueQuantity

        private IQuantity getValueQuantity​(java.lang.String settingValue)
        Used to parse the value of a Recording Setting Period attribute
        Parameters:
        settingValue - the value to parse
        Returns:
        an IQuantity representation of the passed String object
      • getConfigurationAttributes

        public java.util.Collection<TypedPreference<?>> getConfigurationAttributes()
        Description copied from interface: IRule
        Gets information about which attributes may be configured during rule evaluation.
        Specified by:
        getConfigurationAttributes in interface IRule
        Returns:
        a list of configuration attributes
      • getId

        public java.lang.String getId()
        Specified by:
        getId in interface IRule
        Returns:
        a unique id for this rule implementation
      • getName

        public java.lang.String getName()
        Specified by:
        getName in interface IRule
        Returns:
        a human readable name for this rule
      • getTopic

        public java.lang.String getTopic()
        Specified by:
        getTopic in interface IRule
        Returns:
        the topic for this rule, may be null