|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.ibm.dtfj.analyzer.util.WorkHeap
public class WorkHeap
Define a container to hold a subset of the objects reachable from the the Runtime. In essence we tell this class what objects we care about by passing iterators. We can then do operations on this heap to find the set of reachable objects etc.
Field Summary | |
---|---|
static int |
DEFAULT_GRAIN
The default to be used to define the expected object grain - minimum object size |
Constructor Summary | |
---|---|
WorkHeap()
Build an heap with default grain and unlimited size |
|
WorkHeap(ClassDirectory dir)
Build a heap with default grain and unlimited size using the given class directory. |
|
WorkHeap(int grain)
Build an empty heap with the given grain (object address granularity) |
|
WorkHeap(int grain,
long size)
Build an empty heap with the given grain (object address granularity) and maximum size. |
Method Summary | |
---|---|
void |
buildReferenceTables(ObjectIterator objs)
Build the set of references and referenced-by indexes for the reachable objects |
void |
checkReferenceCounts(ObjectIterator objs)
Assume that the set of references and referenced-by indexes for the reachable objects re complete and then test them for accuracy |
void |
clear()
Clear all mark and reference information |
void |
clearMarks()
Clear all mark information |
void |
clearReferences()
Clear all reference information |
static int |
countMarkedObjects(ObjectIterator itr,
ObjectMarkSet marks)
Count the total marked objects by iterating over the set and observing the given set of marks. |
long |
countMarks()
Count the number of marked objects |
ObjectMarkSet |
getActualMarks()
Get the set of marked objects. |
ClassDirectory |
getDirectory()
Get the class directory used to find classes. |
int |
getGrain()
Get the object granularity. |
ObjectMarkSet |
getMarks()
Get the set of marked objects. |
void |
markDeep(ObjectIterator objs)
Mark the set of objects identified by the given iterator and everything that those objects reach. |
ObjectMarkSet |
markOnReferenceCount(int limit,
boolean above)
Look at all the objects in the heap and mark them based on how many objects they reference. |
ObjectMarkSet |
markOnReferencedByCount(int limit,
boolean above)
Look at all the objects in the heap and mark them based on how many objects they are referenced by. |
static ObjectMarkSet |
markReferences(ObjectIterator itr,
ClassDirectory dir,
int grain)
This is a convenience method designed to be used as part of a marking scheme. |
void |
markRefsFrom(ObjectIterator objs)
Mark the set of objects identified by the given iterator. |
ObjectMarkSet |
markRoots()
Look at all the objects in the heap and mark any that have no references to them - the assumed set of root objects. |
void |
markShallow(ObjectIterator objs)
Mark the objects identified by the given iterator. |
void |
processObject(java.lang.Object context,
com.ibm.dtfj.java.JavaObject obj)
(non-Javadoc) |
void |
reportReferences(ObjectIterator objs,
IAnalysisReport report)
Assuming that the set of references and referenced-by indexes for the reachable objects are complete show the reference trees for the iterated objects. |
void |
setDirectory(ClassDirectory dir)
Set the class directory used to find classes. |
java.lang.String |
toString()
(non-Javadoc) |
static long |
totalObjectSize(ObjectIterator itr)
Count the total size of the objects in the iterator. |
void |
unmarkShallow(ObjectIterator objs)
Unmark the objects identified by the given iterator. |
void |
visitIfClassIsMarked(ObjectIterator objs,
ObjectObserver obs,
boolean mark)
Iterate over the objects in the iterator and call the observer for any of them which are instances of a class which is marked. |
void |
visitIfClassLoaderIsMarked(ObjectIterator objs,
ObjectObserver obs,
boolean mark)
Iterate over the objects in the iterator and call the observer for any of them which are instances of a class which was loaded by a loader that is marked. |
void |
visitIfReferencesMarkedObject(ObjectIterator objs,
ObjectObserver obs,
boolean mark)
Iterate over the objects in the iterator and call the observer if any of them reference an object which is already marked. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final int DEFAULT_GRAIN
Constructor Detail |
---|
public WorkHeap()
public WorkHeap(ClassDirectory dir)
dir
- the directory to use when getting class scannerspublic WorkHeap(int grain)
grain
- the addressing granularitypublic WorkHeap(int grain, long size)
grain
- the addressing granularitysize
- the largest addressMethod Detail |
---|
public static ObjectMarkSet markReferences(ObjectIterator itr, ClassDirectory dir, int grain)
itr
- an iterator defining the objects to markdir
- an optional class directory or nullgrain
- the object granularity
public static int countMarkedObjects(ObjectIterator itr, ObjectMarkSet marks)
itr
- the set of objectsmarks
- the marks
public static long totalObjectSize(ObjectIterator itr)
itr
- the set of objects
public void setDirectory(ClassDirectory dir)
dir
- the class directory to usepublic ClassDirectory getDirectory()
public int getGrain()
public void clearMarks()
public void clearReferences()
public void clear()
public void markShallow(ObjectIterator objs)
objs
- an iterator over the set of objectspublic void unmarkShallow(ObjectIterator objs)
objs
- an iterator over the set of objectspublic void visitIfReferencesMarkedObject(ObjectIterator objs, ObjectObserver obs, boolean mark)
objs
- an iterator over the set of objectsobs
- an observer to call with objects that we have identifiedmark
- if true then mark the newly found objectpublic void visitIfClassIsMarked(ObjectIterator objs, ObjectObserver obs, boolean mark)
objs
- an iterator over the set of objectsobs
- an observer to call with objects that we have identifiedmark
- if true then mark the newly found objectpublic void visitIfClassLoaderIsMarked(ObjectIterator objs, ObjectObserver obs, boolean mark)
objs
- an iterator over the set of objectsobs
- an observer to call with objects that we have identifiedmark
- if true then mark the newly found objectpublic void markDeep(ObjectIterator objs)
objs
- an iterator over the set of objectspublic void markRefsFrom(ObjectIterator objs)
objs
- an iterator over the set of objectspublic ObjectMarkSet getActualMarks()
public ObjectMarkSet getMarks()
public void buildReferenceTables(ObjectIterator objs)
objs
- an iterator over the set of objectspublic void checkReferenceCounts(ObjectIterator objs)
objs
- an iterator over the set of objectspublic void reportReferences(ObjectIterator objs, IAnalysisReport report)
objs
- an iterator over the set of objectsreport
- the report to get the informationpublic ObjectMarkSet markRoots()
public ObjectMarkSet markOnReferenceCount(int limit, boolean above)
limit
- the desired number of referencesabove
- if true mark objects with more than limit references else mark
objects with less than or equal to the number of refs.
public ObjectMarkSet markOnReferencedByCount(int limit, boolean above)
limit
- the desired number of referencesabove
- if true mark objects with more than limit references else mark
objects with less than or equal to the number of refs.
public void processObject(java.lang.Object context, com.ibm.dtfj.java.JavaObject obj)
processObject
in interface ObjectObserver
context
- the context - possibly the object heapobj
- the object itselfObjectObserver.processObject(
Object, com.ibm.dtfj.java.JavaObject)
public long countMarks()
public java.lang.String toString()
toString
in class java.lang.Object
Object.toString()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |