|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
edu.wisc.ssec.mcidasv.util.MemoryMonitor
public class MemoryMonitor
Nested Class Summary |
---|
Nested classes/interfaces inherited from class javax.swing.JPanel |
---|
JPanel.AccessibleJPanel |
Nested classes/interfaces inherited from class javax.swing.JComponent |
---|
JComponent.AccessibleJComponent |
Nested classes/interfaces inherited from class java.awt.Container |
---|
Container.AccessibleAWTContainer |
Nested classes/interfaces inherited from class java.awt.Component |
---|
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy |
Field Summary | |
---|---|
private static Font |
clockFont
|
private static SimpleDateFormat |
clockFormat
|
private static DecimalFormat |
fmt
format |
private JLabel |
label
the label |
private static long |
lastTimeRanGC
Keep track of the last time we ran the gc and cleared the cache |
private String |
mbString
|
private String |
memoryString
|
private int |
percentCancel
percent cancel |
private int |
percentThreshold
percent threshold |
private boolean |
running
flag for running |
private boolean |
showClock
|
private long |
sleepInterval
sleep interval |
private StateManager |
stateManager
|
private Thread |
thread
a thread |
private int |
timesAboveThreshold
number of times above the threshold |
private boolean |
triedToCancel
have we tried to cancel the load yet |
Fields inherited from class javax.swing.JComponent |
---|
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW |
Fields inherited from class java.awt.Component |
---|
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
Fields inherited from interface java.awt.image.ImageObserver |
---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
---|---|
MemoryMonitor(StateManager stateManager)
Default constructor |
|
MemoryMonitor(StateManager stateManager,
int percentThreshold,
int percentCancel,
boolean showClock)
Create a new MemoryMonitor |
Method Summary | |
---|---|
private Color |
doColorThing(int percent)
|
boolean |
getRunning()
Get whether we are running |
private String |
getToolTip()
Returns a description of either the clock or memory monitor GUI. |
private void |
handleMouseEvent(MouseEvent event)
Handle a mouse event |
static void |
main(String[] args)
Test routine |
private void |
popupMenu(MouseEvent event)
Popup a menu on an event |
void |
run()
Run this monitor |
void |
runGC()
Run the GC and clear the cache |
void |
setLabelFont(Font f)
Set the label font |
void |
setRunning(boolean r)
Set whether we are running |
private void |
showStats()
Show the statistics. |
private void |
start()
Start running |
void |
stop()
Stop running |
private void |
toggleClock()
|
void |
toggleRunning()
Toggle running |
Methods inherited from class javax.swing.JPanel |
---|
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
private boolean running
private final long sleepInterval
private Thread thread
private final int percentThreshold
private int timesAboveThreshold
private final int percentCancel
private boolean triedToCancel
private static DecimalFormat fmt
private JLabel label
private static long lastTimeRanGC
private StateManager stateManager
private String memoryString
private String mbString
private boolean showClock
private static final Font clockFont
private static SimpleDateFormat clockFormat
Constructor Detail |
---|
public MemoryMonitor(StateManager stateManager)
stateManager
- public MemoryMonitor(StateManager stateManager, int percentThreshold, int percentCancel, boolean showClock)
stateManager
- percentThreshold
- the percentage of use memory before garbage
collection is run.percentCancel
- showClock
- Method Detail |
---|
private void handleMouseEvent(MouseEvent event)
event
- the eventprivate void toggleClock()
private String getToolTip()
private void popupMenu(MouseEvent event)
event
- the eventpublic void toggleRunning()
public void setLabelFont(Font f)
f
- the fontpublic void stop()
private void start()
public void runGC()
private void showStats() throws IllegalStateException
IllegalStateException
private Color doColorThing(int percent)
public void run()
run
in interface Runnable
public void setRunning(boolean r)
r
- true if we are runningpublic boolean getRunning()
public static void main(String[] args)
args
- not used
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |