cds.util
Class Memcounter
java.lang.Object
cds.util.Memcounter
- public class Memcounter
- extends java.lang.Object
Memcounter: utility class to measure memory usage
This class can help in improving the memory management and garbage
collection of an application, by displaying the status of the
heap, memory consumption between two points (start()..stop()).
These operations can be or not preceeded by a synchroneous call to
the garbage collector. The analysis results are written in a log file.
Constructor Summary |
Memcounter(java.lang.String logfilename)
Memcounter: constructor.
|
Method Summary |
void |
closelog()
|
private java.lang.String |
getname(java.lang.String name)
|
void |
show(java.lang.String name)
|
void |
show(java.lang.String name,
boolean do_gc)
show: displays the current status of the heap (preceeded or not by a
garbage collection) |
void |
start(java.lang.String name,
boolean do_gc)
|
void |
stop(java.lang.String name,
boolean do_gc)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
flog
static WriteFile flog
memstatus
static java.util.Hashtable memstatus
Memcounter
public Memcounter(java.lang.String logfilename)
- Memcounter: constructor.
Specifies the output file. If the file cannot be created, then the programms continues
without any output.
- Parameters:
logfilename
- name for the logfile. can be "-","out" or "err" for standard output files
getname
private java.lang.String getname(java.lang.String name)
show
public void show(java.lang.String name,
boolean do_gc)
- show: displays the current status of the heap (preceeded or not by a
garbage collection)
- Parameters:
name
- text writtent on the display linedo_gc
- true if a garbage collection is to be done before getting the heap status
start
public void start(java.lang.String name,
boolean do_gc)
stop
public void stop(java.lang.String name,
boolean do_gc)
show
public void show(java.lang.String name)
closelog
public void closelog()