Class Profiler

  • All Implemented Interfaces:
    IProfiler, java.io.Serializable

    public class Profiler
    extends java.lang.Object
    implements IProfiler, java.io.Serializable
    Default implementation for profiler.
    See Also:
    Serialized Form
    • Field Detail

      • name

        protected java.lang.String name
        The file name for saving.
      • profiles

        protected java.util.List profiles
        The recorded (finished) profilings.
      • stack

        protected java.util.List stack
        The stack of open profilings.
      • cut

        protected int cut
        The cut index (older entries are removed).
    • Constructor Detail

      • Profiler

        public Profiler​(java.lang.String name)
        Create a new profiler.
    • Method Detail

      • start

        public void start​(java.lang.String type,
                          java.lang.Object item)
        Start profiling an item. Nesting (i.e. calling start() several times before calling corresponding stops) is allowed.
        Specified by:
        start in interface IProfiler
        Parameters:
        type - A constant representing the event or activity type being profiled (e.g. object added).
        item - An optional element corresponding to the activity (e.g. the object type).
      • stop

        public void stop​(java.lang.String type,
                         java.lang.Object item)
        Stop profiling the current item. Calls to stop() have match the last unstopped call to start(), with respect to the supplied types and items.
        Specified by:
        stop in interface IProfiler
        Parameters:
        type - A constant representing the event or activity type being profiled (e.g. object added).
        item - The element corresponding to the activity (e.g. the object type).
      • getProfilingInfos

        public IProfiler.ProfilingInfo[] getProfilingInfos​(int start)
        Get the current profiling infos from the given start index.
        Specified by:
        getProfilingInfos in interface IProfiler
        Parameters:
        start - The start index (use 0 for all profiling infos).