edu.stanford.nlp.util
Class MemoryMonitor

java.lang.Object
  extended by edu.stanford.nlp.util.MemoryMonitor

public class MemoryMonitor
extends Object

Utilities for monitoring memory use, including peak memory use.


Nested Class Summary
static class MemoryMonitor.PeakMemoryMonitor
          This class offers a simple way to track the peak memory used by a program.
 
Field Summary
protected  int freeMem
           
protected  long lastPoll
           
static int MAX_SWAPS
           
protected  long pollEvery
           
protected  Runtime r
           
protected  int swaps
           
protected  int usedSwap
           
 
Constructor Summary
MemoryMonitor()
           
MemoryMonitor(long millis)
           
 
Method Summary
 int getMaxAvailableMemory()
           
 int getMaxAvailableMemory(boolean accurate)
           
 int getMaxMemory()
           
 int getSystemFreeMemory(boolean accurate)
           
 double getSystemSwapsPerSec()
           
 int getSystemUsedSwap()
           
 int getUsedMemory()
           
 int getUsedMemory(boolean accurate)
           
static void main(String[] args)
           
protected static ArrayList<String> parseFields(BufferedReader br, String splitStr, int[] lineNums, int[] positions)
           
 void pollAtMostEvery(long millis)
           
 void pollFree(boolean force)
           
 void pollVMstat(boolean force)
           
 boolean systemIsSwapping()
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

MAX_SWAPS

public static final int MAX_SWAPS
See Also:
Constant Field Values

lastPoll

protected long lastPoll

pollEvery

protected long pollEvery

freeMem

protected int freeMem

usedSwap

protected int usedSwap

swaps

protected int swaps

r

protected Runtime r
Constructor Detail

MemoryMonitor

public MemoryMonitor()

MemoryMonitor

public MemoryMonitor(long millis)
Method Detail

pollAtMostEvery

public void pollAtMostEvery(long millis)

getMaxMemory

public int getMaxMemory()

getMaxAvailableMemory

public int getMaxAvailableMemory()

getMaxAvailableMemory

public int getMaxAvailableMemory(boolean accurate)

getUsedMemory

public int getUsedMemory()

getUsedMemory

public int getUsedMemory(boolean accurate)

getSystemFreeMemory

public int getSystemFreeMemory(boolean accurate)

getSystemUsedSwap

public int getSystemUsedSwap()

getSystemSwapsPerSec

public double getSystemSwapsPerSec()

parseFields

protected static ArrayList<String> parseFields(BufferedReader br,
                                               String splitStr,
                                               int[] lineNums,
                                               int[] positions)
                                        throws IOException
Throws:
IOException

pollFree

public void pollFree(boolean force)

pollVMstat

public void pollVMstat(boolean force)

systemIsSwapping

public boolean systemIsSwapping()

toString

public String toString()
Overrides:
toString in class Object

main

public static void main(String[] args)
                 throws InterruptedException
Throws:
InterruptedException


Stanford NLP Group