Package org.openjdk.jol.info
Class GraphLayout
- java.lang.Object
-
- org.openjdk.jol.info.GraphLayout
-
public class GraphLayout extends java.lang.ObjectHolds the object graph layout info.
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.Map<java.lang.Long,GraphPathRecord>addressesprivate booleanaddressStableprivate intaddressTriesprivate Multiset<java.lang.Class<?>>classCountsprivate java.util.Set<java.lang.Class<?>>classesprivate Multiset<java.lang.Class<?>>classSizesprivate java.lang.Stringdescriptionprivate java.util.List<GraphPathRecord>gprsprivate longmaxAddressprivate longminAddressprivate booleanprocessedAddressesprivate booleanprocessedHistoprivate booleanprocessedTotalsprivate longtotalCountprivate longtotalSize
-
Constructor Summary
Constructors Constructor Description GraphLayout(java.lang.Object... roots)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description GraphLayoutadd(GraphLayout another)Add another layout data to the current one.(package private) voidaddRecord(GraphPathRecord gpr)java.util.SortedSet<java.lang.Long>addresses()Answer the set of addresses for the discovered objectslongendAddress()Answer the ending address of observed memory chunkprivate voidensureProcessedAddresses()private voidensureProcessedHisto()private voidensureProcessedTotals()Multiset<java.lang.Class<?>>getClassCounts()Answer the class countsjava.util.Set<java.lang.Class<?>>getClasses()Answer the set of observed classesMultiset<java.lang.Class<?>>getClassSizes()Answer the class sizes.static GraphLayoutparseInstance(java.lang.Object... roots)Parse the object graph starting from the given instance.GraphPathRecordrecord(long address)Get the object descriptor for the given addresslongstartAddress()Answer the starting address of observed memory chunkGraphLayoutsubtract(GraphLayout another)Subtract another layout data from the current one.java.lang.StringtoFootprint()Get the stringly representation of footprint tablevoidtoImage(java.lang.String fileName)Put the graphical representation of object graph into the file.java.lang.StringtoPrintable()Get the stringly representation of object graphlongtotalCount()Answer the total instance countlongtotalSize()Answer the total instance footprint
-
-
-
Field Detail
-
gprs
private final java.util.List<GraphPathRecord> gprs
-
description
private final java.lang.String description
-
processedHisto
private volatile boolean processedHisto
-
classes
private java.util.Set<java.lang.Class<?>> classes
-
classSizes
private Multiset<java.lang.Class<?>> classSizes
-
classCounts
private Multiset<java.lang.Class<?>> classCounts
-
processedAddresses
private volatile boolean processedAddresses
-
addresses
private java.util.Map<java.lang.Long,GraphPathRecord> addresses
-
minAddress
private long minAddress
-
maxAddress
private long maxAddress
-
addressTries
private int addressTries
-
addressStable
private boolean addressStable
-
processedTotals
private volatile boolean processedTotals
-
totalCount
private long totalCount
-
totalSize
private long totalSize
-
-
Method Detail
-
parseInstance
public static GraphLayout parseInstance(java.lang.Object... roots)
Parse the object graph starting from the given instance.- Parameters:
roots- root instances to start from- Returns:
- object graph
-
addRecord
void addRecord(GraphPathRecord gpr)
-
ensureProcessedAddresses
private void ensureProcessedAddresses()
-
subtract
public GraphLayout subtract(GraphLayout another)
Subtract another layout data from the current one. This method does not change the current data object, but produces another one. Note that the object identity is derived from object addresses: if some objects move, they will be treated as new/absent. You may want to quiesce the heap (possibly doing several back-to-back GCs) before taking the snapshots.- Parameters:
another- data object- Returns:
- new data object, that contains the difference.
-
add
public GraphLayout add(GraphLayout another)
Add another layout data to the current one. This method does not change the current data object, but produces another one. Note that the object identity is derived from object addresses: if some objects move, they will be treated as new. You may want to quiesce the heap (possibly doing several back-to-back GCs) before taking the snapshots.- Parameters:
another- data object- Returns:
- new data object, that contains the union.
-
ensureProcessedHisto
private void ensureProcessedHisto()
-
getClassSizes
public Multiset<java.lang.Class<?>> getClassSizes()
Answer the class sizes.- Returns:
- class sizes multiset
-
getClassCounts
public Multiset<java.lang.Class<?>> getClassCounts()
Answer the class counts- Returns:
- class counts multiset
-
getClasses
public java.util.Set<java.lang.Class<?>> getClasses()
Answer the set of observed classes- Returns:
- observed classes set
-
ensureProcessedTotals
private void ensureProcessedTotals()
-
totalCount
public long totalCount()
Answer the total instance count- Returns:
- total instance count
-
totalSize
public long totalSize()
Answer the total instance footprint- Returns:
- total instance footprint, bytes
-
startAddress
public long startAddress()
Answer the starting address of observed memory chunk- Returns:
- starting address
-
endAddress
public long endAddress()
Answer the ending address of observed memory chunk- Returns:
- ending address
-
addresses
public java.util.SortedSet<java.lang.Long> addresses()
Answer the set of addresses for the discovered objects- Returns:
- sorted set of addresses
- See Also:
record(long)
-
record
public GraphPathRecord record(long address)
Get the object descriptor for the given address- Parameters:
address- address- Returns:
- object descriptor
-
toFootprint
public java.lang.String toFootprint()
Get the stringly representation of footprint table- Returns:
- footprint table
-
toPrintable
public java.lang.String toPrintable()
Get the stringly representation of object graph- Returns:
- linearized text form of object graph
-
toImage
public void toImage(java.lang.String fileName) throws java.io.IOExceptionPut the graphical representation of object graph into the file.- Parameters:
fileName- filename- Throws:
java.io.IOException- when I/O fails
-
-