Class MemoryAnalyzer
- java.lang.Object
-
- java.lang.Thread
-
- org.pushingpixels.radiance.theming.internal.utils.TrackableThread
-
- org.pushingpixels.radiance.theming.internal.utils.MemoryAnalyzer
-
- All Implemented Interfaces:
java.lang.Runnable
public class MemoryAnalyzer extends TrackableThread
Tracer for memory usage patterns of Radiance look-and-feel. The tracer is started whenRadianceThemingCortex.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 everyXseconds. TheX(delay) is specified in the constructor. This class is for internal use only.
-
-
Field Summary
Fields Modifier and Type Field Description private longdelaySleep delay between trace log iterations.private java.lang.StringfilenameTrace logfile name.private static MemoryAnalyzerinstanceSingleton instance.private static booleanisStopRequestIftrue,thistracer has received a request to stop.private static java.text.SimpleDateFormatsdfFormatting object.private static java.util.ArrayList<java.lang.String>usagesUsage strings collected during the sleep time.
-
Constructor Summary
Constructors Modifier Constructor Description privateMemoryAnalyzer(long delay, java.lang.String filename)Simple constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static voidcommence(long delay, java.lang.String filename)Starts the memory tracing.static voidenqueueUsage(java.lang.String usage)Adds usage string.static java.util.ArrayList<java.lang.String>getUsages()Returns all queued usages.private static booleanhasStopRequest()Checks whether a request to stop tracing has been issued.static booleanisRunning()Checks whether tracer is running.voidrequestStop()Issues request to stop tracing.voidrun()-
Methods inherited from class org.pushingpixels.radiance.theming.internal.utils.TrackableThread
requestStopAllThreads
-
Methods inherited from class java.lang.Thread
activeCount, checkAccess, clone, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, onSpinWait, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
-
-
-
-
Field Detail
-
delay
private long delay
Sleep delay between trace log iterations.
-
filename
private java.lang.String filename
Trace logfile name.
-
instance
private static MemoryAnalyzer instance
Singleton instance.
-
isStopRequest
private static boolean isStopRequest
Iftrue,thistracer has received a request to stop.
-
usages
private static java.util.ArrayList<java.lang.String> usages
Usage strings collected during the sleep time.
-
sdf
private static java.text.SimpleDateFormat sdf
Formatting object.
-
-
Method Detail
-
commence
public static void commence(long delay, java.lang.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:
requestStopin classTrackableThread
-
hasStopRequest
private static boolean hasStopRequest()
Checks whether a request to stop tracing has been issued.- Returns:
trueif a request to stop tracing has been issued,falseotherwise.
-
isRunning
public static boolean isRunning()
Checks whether tracer is running.- Returns:
trueif tracer is running,falseotherwise.
-
enqueueUsage
public static void enqueueUsage(java.lang.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 java.util.ArrayList<java.lang.String> getUsages()
Returns all queued usages.- Returns:
- All queued usages.
-
run
public void run()
- Specified by:
runin interfacejava.lang.Runnable- Overrides:
runin classjava.lang.Thread
-
-