GCA 0.4.0

pfg.gca
Class GCRecord

java.lang.Object
  |
  +--pfg.gca.GCRecord
Direct Known Subclasses:
AFRecord

public class GCRecord
extends java.lang.Object

A GC record represents a single garbage collection activity. It is independent of whether the GC occured due to a manual GC request or an allocation failure.

Author:
Paul Glezen

Field Summary
protected  long bytesAvailable
          See getBytesAvailable().
protected  long bytesFree
          See getBytesFree().
protected  long bytesReclaimed
          See getBytesReclaimed().
protected  int compact
          See getCompactTime().
protected  int gcIndex
          See getGcIndex().
protected  int mark
          See getMarkTime().
protected  java.util.Date startTime
          See getStartTime().
protected  int sweep
          See getSweepTime().
 
Constructor Summary
GCRecord()
          Create an empty struct.
GCRecord(int gcIndex, int mark, int sweep, int compact, java.util.Date startTime, long bytesReclaimed, long bytesFree, long bytesAvailable)
          Create a new GCRecord.
 
Method Summary
 long getBytesAvailable()
          Get bytes presently available to the heap.
 long getBytesFree()
          Get the amounts of bytes free after a GC.
 long getBytesReclaimed()
          Get bytes freed by the GC.
 int getCompactTime()
          Get the compaction time.
 int getGcIndex()
          Get the index for this GC activity.
 int getMarkTime()
          Get the mark time.
 java.util.Date getStartTime()
          Get the start time for this GC activity.
 int getSweepTime()
          Get the sweep time.
 int getTotalTime()
          Return the total time for this GC activity.
 void setBytesAvailable(long bytesAvailable)
          Set the bytes available on the heap.
 void setBytesFree(long bytesFree)
          Set the number of bytes freed by this GC activity.
 void setBytesReclaimed(long bytesReclaimed)
          Set the bytes reclaimed by this GC activity.
 void setCompactTime(int compact)
          Set the GC compaction time.
 void setGcIndex(int gcIndex)
          Get the index for this GC activity.
 void setMarkTime(int mark)
          Set the mark time.
 void setStartTime(java.util.Date startTime)
          Set the start time of this GC activity.
 void setSweepTime(int sweep)
          Set the sweep time.
 java.lang.String toString()
          Send a one-line summary of the contents of this GC activity to system-out.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

bytesAvailable

protected long bytesAvailable
See getBytesAvailable().

bytesFree

protected long bytesFree
See getBytesFree().

bytesReclaimed

protected long bytesReclaimed
See getBytesReclaimed().

compact

protected int compact
See getCompactTime().

gcIndex

protected int gcIndex
See getGcIndex().

mark

protected int mark
See getMarkTime().

startTime

protected java.util.Date startTime
See getStartTime().

sweep

protected int sweep
See getSweepTime().
Constructor Detail

GCRecord

public GCRecord()
Create an empty struct.

GCRecord

public GCRecord(int gcIndex,
                int mark,
                int sweep,
                int compact,
                java.util.Date startTime,
                long bytesReclaimed,
                long bytesFree,
                long bytesAvailable)
Create a new GCRecord.

Parameters:
gcIndex - the integer associated with this GC activity
mark - mark time
sweep - sweep time
compact - compaction time
startTime - time at which this GC activity began
bytesReclaimed - bytes reclaimed by this GC activity
bytesFree - bytes available on the heap after GC
bytesAvailable - total bytes available on heap
Method Detail

getBytesAvailable

public long getBytesAvailable()
Get bytes presently available to the heap. This includes memory that is being used as well as memory available for allocation of new objects.

Returns:
memory available in bytes

getBytesFree

public long getBytesFree()
Get the amounts of bytes free after a GC. The bytes free refers to heap bytes available for allocation of new objects.

Returns:
memory available (in bytes) for new object allocation

getBytesReclaimed

public long getBytesReclaimed()
Get bytes freed by the GC.

Returns:
memory reclaimed in bytes

getCompactTime

public int getCompactTime()
Get the compaction time. In the mark and sweep strategy, compaction is only performed on an as-needed basis. When compaction is not needed, this time will be zero.

Returns:
compaction time in milliseconds

getGcIndex

public int getGcIndex()
Get the index for this GC activity. Each GC activity has an associated index.

getMarkTime

public int getMarkTime()
Get the mark time. The mark time is the first stage of the "mark and sweep" strategy in which it is determined which memory blocks that are no longer referenced. These are marked for reclaimation.

Returns:
mark time in milliseconds

getStartTime

public java.util.Date getStartTime()
Get the start time for this GC activity.

Returns:
time GC activity started as Date object

getSweepTime

public int getSweepTime()
Get the sweep time. The sweep time is the second stage of the "mark and sweep" strategy in which memory blocks that have been marked for reclaimation are freed.

Returns:
sweep time in milliseconds

getTotalTime

public int getTotalTime()
Return the total time for this GC activity. The total time is the sum of the mark time, the sweep time and the compaction time.

setBytesAvailable

public void setBytesAvailable(long bytesAvailable)
Set the bytes available on the heap.

Parameters:
bytesAvailable -  

setBytesFree

public void setBytesFree(long bytesFree)
Set the number of bytes freed by this GC activity.

Parameters:
bytesFree -  

setBytesReclaimed

public void setBytesReclaimed(long bytesReclaimed)
Set the bytes reclaimed by this GC activity.

Parameters:
bytesReclaimed -  

setCompactTime

public void setCompactTime(int compact)
Set the GC compaction time.

Parameters:
compact - compaction time in milliseconds

setGcIndex

public void setGcIndex(int gcIndex)
Get the index for this GC activity. Each GC is assigned an index by the JVM.

Parameters:
gcIndex - the index for this GC activity

setMarkTime

public void setMarkTime(int mark)
Set the mark time.

Parameters:
mark - mark time in milliseconds

setStartTime

public void setStartTime(java.util.Date startTime)
Set the start time of this GC activity.

Parameters:
startTime - start time as a Date object

setSweepTime

public void setSweepTime(int sweep)
Set the sweep time.

Parameters:
sweep - sweep time in milliseconds

toString

public java.lang.String toString()
Send a one-line summary of the contents of this GC activity to system-out.
Overrides:
toString in class java.lang.Object

Paul Glezen
http://glezen.org/gca/

Generated: February 24 2005