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:
Runnable
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.-
Nested Class Summary
Nested classes/interfaces inherited from class Thread
Thread.State, Thread.UncaughtExceptionHandler -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate longSleep delay between trace log iterations.private StringTrace logfile name.private static MemoryAnalyzerSingleton instance.private static booleanIftrue,thistracer has received a request to stop.private static SimpleDateFormatFormatting object.Usage strings collected during the sleep time.Fields inherited from class Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateMemoryAnalyzer(long delay, String filename) Simple constructor. -
Method Summary
Modifier and TypeMethodDescriptionstatic voidStarts the memory tracing.static voidenqueueUsage(String usage) Adds usage string.Returns all queued usages.private static booleanChecks whether a request to stop tracing has been issued.static booleanChecks whether tracer is running.voidIssues request to stop tracing.voidrun()Methods inherited from class TrackableThread
requestStopAllThreadsMethods inherited from class 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 Details
-
delay
private long delaySleep delay between trace log iterations. -
filename
Trace logfile name. -
instance
Singleton instance. -
isStopRequest
private static boolean isStopRequestIftrue,thistracer has received a request to stop. -
usages
-
sdf
Formatting object.
-
-
Constructor Details
-
MemoryAnalyzer
Simple constructor.- Parameters:
delay- Sleep delay between trace log iterations.filename- Trace logfile name.
-
-
Method Details
-
commence
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
Adds usage string.- Parameters:
usage- Usage string. Will be output to the trace file at next iteration of the tracer.
-
getUsages
-
run
-