Class IdentityHashMapCollectionExtractor
- java.lang.Object
-
- org.eclipse.mat.internal.collectionextract.FieldArrayCollectionExtractor
-
- org.eclipse.mat.internal.collectionextract.FieldSizeArrayCollectionExtractor
-
- org.eclipse.mat.internal.collectionextract.IdentityHashMapCollectionExtractor
-
- All Implemented Interfaces:
ICollectionExtractor,IMapExtractor
public class IdentityHashMapCollectionExtractor extends FieldSizeArrayCollectionExtractor implements IMapExtractor
Info for IdentityHashMaps These are stored as key/value pairs in an array
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.eclipse.mat.inspections.collectionextract.IMapExtractor
IMapExtractor.EntryObject
-
-
Constructor Summary
Constructors Constructor Description IdentityHashMapCollectionExtractor(java.lang.String sizeField, java.lang.String arrayField)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int[]extractEntryIds(IObject idMap)Returns the object ids (int) for all objects which are contained in the collectionjava.util.Iterator<java.util.Map.Entry<IObject,IObject>>extractMapEntries(IObject coll)Extracts the contents of a map (i.e.java.lang.IntegergetCapacity(IObject collection)Gets the capacity of the map.java.lang.DoublegetCollisionRatio(IObject coll)Complete guess as to collision ratio.java.lang.DoublegetFillRatio(IObject coll)Calculate the fill ratio of a collectionjava.lang.IntegergetNumberOfNotNullElements(IObject coll)Returns the number of non-null elements in the collection.java.lang.IntegergetSize(IObject coll)Extract the size of the collection.booleanhasCollisionRatio()Can't calculate the collision ratio as we don't have the identityHashCode for the keys, even if we did know the hash algorithm.booleanhasExtractableArray()Return true if the collection array based and the array can be extracted from the heap dumpbooleanhasExtractableContents()Check if the collection has extractable contents-
Methods inherited from class org.eclipse.mat.internal.collectionextract.FieldSizeArrayCollectionExtractor
hasSize
-
Methods inherited from class org.eclipse.mat.internal.collectionextract.FieldArrayCollectionExtractor
extractEntries, hasCapacity, hasFillRatio
-
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.eclipse.mat.inspections.collectionextract.ICollectionExtractor
extractEntries, hasCapacity, hasFillRatio, hasSize
-
-
-
-
Method Detail
-
getCapacity
public java.lang.Integer getCapacity(IObject collection) throws SnapshotException
Gets the capacity of the map. Needs two array elements for each entry.- Specified by:
getCapacityin interfaceICollectionExtractor- Overrides:
getCapacityin classFieldArrayCollectionExtractor- Parameters:
collection- - the collection to find the capacity of- Returns:
- the capacity in bytes, or null if unavailable
- Throws:
SnapshotException- if there is a problem retrieving data from the snapshot- See Also:
ICollectionExtractor.hasCapacity()
-
hasExtractableArray
public boolean hasExtractableArray()
Description copied from interface:ICollectionExtractorReturn true if the collection array based and the array can be extracted from the heap dump- Specified by:
hasExtractableArrayin interfaceICollectionExtractor- Overrides:
hasExtractableArrayin classFieldArrayCollectionExtractor- Returns:
- true if
ICollectionExtractor.extractEntries(IObject)could be called - See Also:
ICollectionExtractor.extractEntries(IObject)
-
hasExtractableContents
public boolean hasExtractableContents()
Description copied from interface:ICollectionExtractorCheck if the collection has extractable contents- Specified by:
hasExtractableContentsin interfaceICollectionExtractor- Overrides:
hasExtractableContentsin classFieldArrayCollectionExtractor- Returns:
- true if
ICollectionExtractor.extractEntryIds(IObject)could be called - See Also:
ICollectionExtractor.extractEntryIds(IObject)
-
getSize
public java.lang.Integer getSize(IObject coll) throws SnapshotException
Description copied from interface:ICollectionExtractorExtract the size of the collection.- Specified by:
getSizein interfaceICollectionExtractor- Overrides:
getSizein classFieldSizeArrayCollectionExtractor- Parameters:
coll- - the collection to find the size of- Returns:
- the size, or null if not available
- Throws:
SnapshotException- if there is a problem retrieving data from the snapshot- See Also:
ICollectionExtractor.hasSize()
-
extractEntryIds
public int[] extractEntryIds(IObject idMap) throws SnapshotException
Description copied from interface:ICollectionExtractorReturns the object ids (int) for all objects which are contained in the collection- Specified by:
extractEntryIdsin interfaceICollectionExtractor- Overrides:
extractEntryIdsin classFieldArrayCollectionExtractor- Parameters:
idMap- - the collection to find the objects it holds- Returns:
- an array of ints which are the object ids.
- Throws:
SnapshotException- if there is a problem retrieving data from the snapshot- See Also:
ICollectionExtractor.hasExtractableContents()
-
hasCollisionRatio
public boolean hasCollisionRatio()
Can't calculate the collision ratio as we don't have the identityHashCode for the keys, even if we did know the hash algorithm.- Specified by:
hasCollisionRatioin interfaceIMapExtractor- Returns:
- true if @
IMapExtractor.getCollisionRatio(IObject)could be called - See Also:
IMapExtractor.getCollisionRatio(IObject)
-
getCollisionRatio
public java.lang.Double getCollisionRatio(IObject coll) throws SnapshotException
Complete guess as to collision ratio. Look for consecutive entries - perhaps they were caused by a linear probe.- Specified by:
getCollisionRatioin interfaceIMapExtractor- Parameters:
coll- - the collection to calculate the collision ratio of- Returns:
- Double number of elements with colliding keys / size
- Throws:
SnapshotException- See Also:
IMapExtractor.hasCollisionRatio()
-
getFillRatio
public java.lang.Double getFillRatio(IObject coll) throws SnapshotException
Description copied from interface:ICollectionExtractorCalculate the fill ratio of a collection- Specified by:
getFillRatioin interfaceICollectionExtractor- Overrides:
getFillRatioin classFieldArrayCollectionExtractor- Parameters:
coll- - the collection to find the fill ratio of- Returns:
- the fill ratio, between 0.0 and 1.0, or null if unavailable
- Throws:
SnapshotException- if there is a problem retrieving data from the snapshot- See Also:
ICollectionExtractor.hasFillRatio()
-
getNumberOfNotNullElements
public java.lang.Integer getNumberOfNotNullElements(IObject coll) throws SnapshotException
Description copied from interface:ICollectionExtractorReturns the number of non-null elements in the collection. Requires hasExtractableContents or hasExtractableArray- Specified by:
getNumberOfNotNullElementsin interfaceICollectionExtractor- Overrides:
getNumberOfNotNullElementsin classFieldArrayCollectionExtractor- Parameters:
coll- - the collection to find the number of non-null content objects- Returns:
- the number of non-null elements, or null if not available
- Throws:
SnapshotException- See Also:
ICollectionExtractor.hasExtractableContents(),ICollectionExtractor.hasExtractableArray()
-
extractMapEntries
public java.util.Iterator<java.util.Map.Entry<IObject,IObject>> extractMapEntries(IObject coll) throws SnapshotException
Description copied from interface:IMapExtractorExtracts the contents of a map (i.e. an IObject representing a Map) and provides an Iterator over them- Specified by:
extractMapEntriesin interfaceIMapExtractor- Parameters:
coll- - the map to extract contents from- Returns:
- an Iterator over the entries. If the original Map had an Entry object, the content of the iterator would usually be EntryObject
- Throws:
SnapshotException
-
-