public class Histogram extends HistogramRecord implements IResultTable, IIconProvider
Modifier and Type | Class and Description |
---|---|
static class |
Histogram.ClassLoaderTree |
static class |
Histogram.PackageTree |
static class |
Histogram.SuperclassTree |
COMPARATOR_FOR_LABEL, COMPARATOR_FOR_NUMBEROFOBJECTS, COMPARATOR_FOR_RETAINEDHEAPSIZE, COMPARATOR_FOR_USEDHEAPSIZE
EMPTY
Constructor and Description |
---|
Histogram(String label,
ArrayList<ClassHistogramRecord> classHistogramRecords,
ArrayList<ClassLoaderHistogramRecord> classLoaderHistogramRecords,
long numberOfObjects,
long usedHeapSize,
long retainedHeapSize)
Construct a histogram
|
Histogram(String label,
ArrayList<ClassHistogramRecord> classHistogramRecords,
ArrayList<ClassLoaderHistogramRecord> classLoaderHistogramRecords,
long numberOfObjects,
long usedHeapSize,
long retainedHeapSize,
boolean isDefaultHistogram)
Construct a histogram
|
Modifier and Type | Method and Description |
---|---|
Histogram |
diffWithBaseline(Histogram baseline)
Compute a new histogram as difference of this histogram compared to
(minus) the given baseline histogram.
|
static String |
generateClassHistogramRecordCsvReport(Histogram histogram,
Comparator<HistogramRecord> comparator)
Generate machine/human readable comma separated report from an histogram.
|
static String |
generateClassHistogramRecordTextReport(Histogram histogram,
Comparator<HistogramRecord> comparator)
Generate human readable text based report from a histogram.
|
static String |
generateClassLoaderHistogramRecordCsvReport(Histogram histogram,
Comparator<HistogramRecord> comparator)
Generate machine/human readable comma separated report from an histogram.
|
Collection<ClassHistogramRecord> |
getClassHistogramRecords()
Get collection of all the classes for all the objects which were found in
the set of objects on which the class histogram was computed.
|
Collection<ClassLoaderHistogramRecord> |
getClassLoaderHistogramRecords()
Get collection of all the class loaders for all the classes for all the
objects which were found in the set of objects on which the class
histogram was computed.
|
Column[] |
getColumns()
The columns of the tree or table.
|
Object |
getColumnValue(Object row,
int columnIndex)
Returns the (unformatted) value of a table/tree cell.
|
IContextObject |
getContext(Object row)
The default context of the row which is used to display information in
the object inspector.
|
URL |
getIcon(Object row) |
ResultMetaData |
getResultMetaData()
(Optionally) Return meta data of the result needed to fine-tune the
display of the result.
|
Object |
getRow(int rowId)
Returns the object of the row with the given row number.
|
int |
getRowCount()
Returns the number of rows in the result table.
|
IResultTree |
groupByClassLoader()
implementation as result tree grouped by class loader
|
IResultTree |
groupByPackage()
implementation as result tree grouped by package
|
IResultTree |
groupBySuperclass(ISnapshot snapshot)
implementation as result tree grouped by superclass
|
Histogram |
intersectWithAnother(Histogram another)
Compute a new histogram as intersection of this histogram compared to
(equals) the given another histogram.
|
boolean |
isDefaultHistogram() |
String |
toString() |
getLabel, getNumberOfObjects, getRetainedHeapSize, getUsedHeapSize, incNumberOfObjects, incNumberOfObjects, incRetainedHeapSize, incUsedHeapSize, reverseComparator, setLabel, setNumberOfObjects, setRetainedHeapSize, setUsedHeapSize
public Histogram(String label, ArrayList<ClassHistogramRecord> classHistogramRecords, ArrayList<ClassLoaderHistogramRecord> classLoaderHistogramRecords, long numberOfObjects, long usedHeapSize, long retainedHeapSize)
label
- the name of the whole histogramclassHistogramRecords
- the classesclassLoaderHistogramRecords
- the class loadersnumberOfObjects
- the total number of objectsusedHeapSize
- the shallow size of all the objectsretainedHeapSize
- the retained size of all the objects, or 0 if unknownpublic Histogram(String label, ArrayList<ClassHistogramRecord> classHistogramRecords, ArrayList<ClassLoaderHistogramRecord> classLoaderHistogramRecords, long numberOfObjects, long usedHeapSize, long retainedHeapSize, boolean isDefaultHistogram)
label
- the name of the whole histogramclassHistogramRecords
- the classesclassLoaderHistogramRecords
- the class loadersnumberOfObjects
- the total number of objectsusedHeapSize
- the shallow size of all the objectsretainedHeapSize
- the retained size of all the objects, or 0 if unknownisDefaultHistogram
- a histogram of the whole snapshotpublic Collection<ClassHistogramRecord> getClassHistogramRecords()
public Collection<ClassLoaderHistogramRecord> getClassLoaderHistogramRecords()
public Histogram diffWithBaseline(Histogram baseline)
This method can be used to check what has changed from one histogram to another, to compute a delta.
baseline
- baseline histogrampublic Histogram intersectWithAnother(Histogram another)
This method can be used to check what remains the same within two histograms, e.g. if you have two histograms it shows what hasn't changed, e.g. if you have two difference histograms it shows what remained the same change (increase or decrease; used in gradient memory leak analysis).
Note: Heap space is not taken into account in this analysis, only the number of objects, i.e. when the number of objects is the same, you will see this number of objects, otherwise or if there are no objects of a particular class you won't get a histogram record for it!
another
- another histogrampublic boolean isDefaultHistogram()
public static String generateClassHistogramRecordTextReport(Histogram histogram, Comparator<HistogramRecord> comparator)
histogram
- histogram you want a human reable text based report forcomparator
- comparator to be used for sorting the histogram records (
HistogramRecord
provides some default comparators)public static String generateClassHistogramRecordCsvReport(Histogram histogram, Comparator<HistogramRecord> comparator)
histogram
- histogram you want a machine/human readable comma separated
report forcomparator
- comparator to be used for sorting the histogram records (
HistogramRecord
provides some default comparators)public static String generateClassLoaderHistogramRecordCsvReport(Histogram histogram, Comparator<HistogramRecord> comparator)
histogram
- histogram you want a machine/human readable comma separated
report forcomparator
- comparator to be used for sorting the histogram records (
HistogramRecord
provides some default comparators)public ResultMetaData getResultMetaData()
IResult
getResultMetaData
in interface IResult
public Column[] getColumns()
IStructuredResult
getColumns
in interface IStructuredResult
public int getRowCount()
IResultTable
getRowCount
in interface IResultTable
public Object getRow(int rowId)
IResultTable
getRow
in interface IResultTable
rowId
- The row number.IStructuredResult.getContext(Object)
or
IStructuredResult.getColumnValue(Object, int)
.public Object getColumnValue(Object row, int columnIndex)
IStructuredResult
getColumnValue
in interface IStructuredResult
row
- The row object as returned by the
IResultTable.getRow(int)
or
IResultTree.getElements()
or
IResultTree.getChildren(Object)
methodscolumnIndex
- The index of the column.public IContextObject getContext(Object row)
IStructuredResult
ResultMetaData
, it is also used for the context menu on a row.getContext
in interface IStructuredResult
row
- The row object as returned by the
IResultTable.getRow(int)
or
IResultTree.getElements()
or
IResultTree.getChildren(Object)
methods.public URL getIcon(Object row)
getIcon
in interface IIconProvider
public IResultTree groupByClassLoader()
public IResultTree groupByPackage()
public IResultTree groupBySuperclass(ISnapshot snapshot)