java.lang.Object
java.lang.Thread
org.pushingpixels.radiance.theming.internal.utils.TrackableThread
org.pushingpixels.radiance.theming.internal.utils.MemoryAnalyzer
All Implemented Interfaces:
Runnable

public class MemoryAnalyzer extends TrackableThread
Tracer for memory usage patterns of Radiance look-and-feel. The tracer is started when RadianceThemingCortex.GlobalScope.setTraceFilename(String) is called before setting Radiance of the look and feel. When activated, the tracer runs a thread that collects information on memory usage and appends it to the trace log file every X seconds. The X (delay) is specified in the constructor. This class is for internal use only.
  • Field Details

    • delay

      private long delay
      Sleep delay between trace log iterations.
    • filename

      private String filename
      Trace logfile name.
    • instance

      private static MemoryAnalyzer instance
      Singleton instance.
    • isStopRequest

      private static boolean isStopRequest
      If true, this tracer has received a request to stop.
    • usages

      private static ArrayList<String> usages
      Usage strings collected during the sleep time.
    • sdf

      private static SimpleDateFormat sdf
      Formatting object.
  • Constructor Details

    • MemoryAnalyzer

      private MemoryAnalyzer(long delay, String filename)
      Simple constructor.
      Parameters:
      delay - Sleep delay between trace log iterations.
      filename - Trace logfile name.
  • Method Details

    • commence

      public static void commence(long delay, String filename)
      Starts the memory tracing.
      Parameters:
      delay - Sleep delay between trace log iterations.
      filename - Trace logfile name.
    • requestStop

      public void requestStop()
      Issues request to stop tracing.
      Specified by:
      requestStop in class TrackableThread
    • hasStopRequest

      private static boolean hasStopRequest()
      Checks whether a request to stop tracing has been issued.
      Returns:
      true if a request to stop tracing has been issued, false otherwise.
    • isRunning

      public static boolean isRunning()
      Checks whether tracer is running.
      Returns:
      true if tracer is running, false otherwise.
    • enqueueUsage

      public static void enqueueUsage(String usage)
      Adds usage string.
      Parameters:
      usage - Usage string. Will be output to the trace file at next iteration of the tracer.
    • getUsages

      public static ArrayList<String> getUsages()
      Returns all queued usages.
      Returns:
      All queued usages.
    • run

      public void run()
      Specified by:
      run in interface Runnable
      Overrides:
      run in class Thread