Class Profiler


  • public final class Profiler
    extends java.lang.Object
    Performance profiler for Mixin.
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  Profiler.Section
      Base abstract profiler section.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static int FINE
      Flag to indicate a fine section.
      static int ROOT
      Flag to indicate a root section.
    • Constructor Summary

      Constructors 
      Constructor Description
      Profiler​(java.lang.String id)  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      Profiler.Section begin​(int flags, java.lang.String name)
      Begin a new profiler section using the specified name and flags
      Profiler.Section begin​(int flags, java.lang.String... path)
      Begin a new profiler section using the specified path and flags
      Profiler.Section begin​(java.lang.String name)
      Begin a new profiler section using the specified name
      Profiler.Section begin​(java.lang.String... path)
      Begin a new profiler section using the specified path
      Profiler.Section get​(java.lang.String name)
      Get the specified profiler section
      static Profiler getProfiler​(java.lang.String id)
      Get the specified performance profiler
      static java.util.Collection<Profiler> getProfilers()
      Get all available performance profilers
      java.util.Collection<Profiler.Section> getSections()
      Get all recorded profiler sections
      void mark​(java.lang.String phase)
      Mark a new phase (time slice) for this profiler, all sections record their current times and then reset to zero.
      static void printAuditSummary()
      Print summary of mixin performance from all active profilers to the console
      PrettyPrinter printer​(boolean includeFine, boolean group)
      Get the profiler state with all sections in a PrettyPrinter.
      void printSummary()
      Print summary of this profiler's recorded performance to the console
      void reset()
      Reset all profiler state
      static void setActive​(boolean active)
      Set the active state of the profiler.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • ROOT

        public static final int ROOT
        Flag to indicate a root section. Root sections are always recorded at the root wherever they occur, but may appear under other sections in order to show the time share of the root section relative to the parent.
        See Also:
        Constant Field Values
      • FINE

        public static final int FINE
        Flag to indicate a fine section. Fine sections are always recorded, but are only displayed in the printed output if the includeFine flag is set.
        See Also:
        Constant Field Values
    • Constructor Detail

      • Profiler

        public Profiler​(java.lang.String id)
    • Method Detail

      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • setActive

        public static void setActive​(boolean active)
        Set the active state of the profiler.
        Parameters:
        active - new active state
      • reset

        public void reset()
        Reset all profiler state
      • get

        public Profiler.Section get​(java.lang.String name)
        Get the specified profiler section
        Parameters:
        name - section name
        Returns:
        profiler section
      • begin

        public Profiler.Section begin​(java.lang.String... path)
        Begin a new profiler section using the specified path
        Parameters:
        path - path parts
        Returns:
        new profiler section
      • begin

        public Profiler.Section begin​(int flags,
                                      java.lang.String... path)
        Begin a new profiler section using the specified path and flags
        Parameters:
        flags - section flags
        path - path parts
        Returns:
        new profiler section
      • begin

        public Profiler.Section begin​(java.lang.String name)
        Begin a new profiler section using the specified name
        Parameters:
        name - section name
        Returns:
        new profiler section
      • begin

        public Profiler.Section begin​(int flags,
                                      java.lang.String name)
        Begin a new profiler section using the specified name and flags
        Parameters:
        flags - section flags
        name - section name
        Returns:
        new profiler section
      • mark

        public void mark​(java.lang.String phase)
        Mark a new phase (time slice) for this profiler, all sections record their current times and then reset to zero. If no times have been recorded in the current phase, the phase is discarded.
        Parameters:
        phase - Name of the phase
      • getSections

        public java.util.Collection<Profiler.Section> getSections()
        Get all recorded profiler sections
      • printer

        public PrettyPrinter printer​(boolean includeFine,
                                     boolean group)
        Get the profiler state with all sections in a PrettyPrinter.
        Parameters:
        includeFine - Include sections marked as FINE
        group - Group delegated sections with their root instead of in the normal alphabetical order
        Returns:
        PrettyPrinter with section data
      • printSummary

        public void printSummary()
        Print summary of this profiler's recorded performance to the console
      • printAuditSummary

        public static void printAuditSummary()
        Print summary of mixin performance from all active profilers to the console
      • getProfiler

        public static Profiler getProfiler​(java.lang.String id)
        Get the specified performance profiler
        Parameters:
        id - Profiler id
        Returns:
        profiler
      • getProfilers

        public static java.util.Collection<Profiler> getProfilers()
        Get all available performance profilers
        Returns:
        immutable collection of profilers