Package org.eclipse.mat.snapshot
Class HistogramRecord
- java.lang.Object
-
- org.eclipse.mat.snapshot.HistogramRecord
-
- All Implemented Interfaces:
java.io.Serializable
- Direct Known Subclasses:
ClassHistogramRecord,ClassHistogramRecordBuilder,ClassLoaderHistogramRecord,ClassLoaderHistogramRecordBuilder,Histogram,HistogramBuilder
public class HistogramRecord extends java.lang.Object implements java.io.SerializableThis class holds all basic data for a histogram record. Other classes inherit from it. It offers comparators to sort histogram records by their basic data. This pattern should be implemented by the classes inheriting from it as well.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static java.util.Comparator<HistogramRecord>COMPARATOR_FOR_LABELstatic java.util.Comparator<HistogramRecord>COMPARATOR_FOR_NUMBEROFOBJECTSstatic java.util.Comparator<HistogramRecord>COMPARATOR_FOR_RETAINEDHEAPSIZEstatic java.util.Comparator<HistogramRecord>COMPARATOR_FOR_USEDHEAPSIZE
-
Constructor Summary
Constructors Constructor Description HistogramRecord(java.lang.String label)Create histogram record just with a label identifying it.HistogramRecord(java.lang.String label, long numberOfObjects, long usedHeapSize, long retainedHeapSize)Create histogram record with a label identifying it and its basic data.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringgetLabel()Get label identifying the histogram record.longgetNumberOfObjects()Get number of objects this histogram record stands for.longgetRetainedHeapSize()Get number of retained bytes in heap area this histogram record stands for.longgetUsedHeapSize()Get number of bytes in heap area this histogram record stands for.voidincNumberOfObjects()Increment number of objects this histogram record stands for by 1.voidincNumberOfObjects(long inc)Increment number of objects this histogram record stands for.voidincRetainedHeapSize(long inc)voidincUsedHeapSize(long inc)Increment number of bytes in heap area this histogram record stands for.static java.util.Comparator<HistogramRecord>reverseComparator(java.util.Comparator<HistogramRecord> comparator)Convenience method reversing the order of the given comparator.voidsetLabel(java.lang.String label)Set label identifying the histogram record.voidsetNumberOfObjects(long numberOfObjects)Set number of objects this histogram record stands for.voidsetRetainedHeapSize(long retainedHeapSize)Set number of retained bytes in heap area this histogram record stands for.voidsetUsedHeapSize(long usedHeapSize)Set number of bytes in heap area this histogram record stands for.
-
-
-
Field Detail
-
COMPARATOR_FOR_LABEL
public static final java.util.Comparator<HistogramRecord> COMPARATOR_FOR_LABEL
-
COMPARATOR_FOR_NUMBEROFOBJECTS
public static final java.util.Comparator<HistogramRecord> COMPARATOR_FOR_NUMBEROFOBJECTS
-
COMPARATOR_FOR_USEDHEAPSIZE
public static final java.util.Comparator<HistogramRecord> COMPARATOR_FOR_USEDHEAPSIZE
-
COMPARATOR_FOR_RETAINEDHEAPSIZE
public static final java.util.Comparator<HistogramRecord> COMPARATOR_FOR_RETAINEDHEAPSIZE
-
-
Constructor Detail
-
HistogramRecord
public HistogramRecord(java.lang.String label)
Create histogram record just with a label identifying it.- Parameters:
label- label identifying the histogram record
-
HistogramRecord
public HistogramRecord(java.lang.String label, long numberOfObjects, long usedHeapSize, long retainedHeapSize)Create histogram record with a label identifying it and its basic data.- Parameters:
label- label identifying the histogram recordnumberOfObjects- number of objects this histogram record stands forusedHeapSize- number of bytes in heap area this histogram record stands for
-
-
Method Detail
-
getLabel
public java.lang.String getLabel()
Get label identifying the histogram record.- Returns:
- label identifying the histogram record
-
setLabel
public void setLabel(java.lang.String label)
Set label identifying the histogram record.- Parameters:
label- label identifying the histogram record
-
getNumberOfObjects
public long getNumberOfObjects()
Get number of objects this histogram record stands for.- Returns:
- number of objects this histogram record stands for
-
setNumberOfObjects
public void setNumberOfObjects(long numberOfObjects)
Set number of objects this histogram record stands for.- Parameters:
numberOfObjects- number of objects this histogram record stands for
-
incNumberOfObjects
public void incNumberOfObjects()
Increment number of objects this histogram record stands for by 1.
-
incNumberOfObjects
public void incNumberOfObjects(long inc)
Increment number of objects this histogram record stands for.- Parameters:
inc- number of objects by which the number of objects should be incremented
-
getUsedHeapSize
public long getUsedHeapSize()
Get number of bytes in heap area this histogram record stands for.- Returns:
- number of bytes in heap area this histogram record stands for
-
setUsedHeapSize
public void setUsedHeapSize(long usedHeapSize)
Set number of bytes in heap area this histogram record stands for.- Parameters:
usedHeapSize- number of bytes in heap area this histogram record stands for
-
incUsedHeapSize
public void incUsedHeapSize(long inc)
Increment number of bytes in heap area this histogram record stands for.- Parameters:
inc- number of bytes by which the number of bytes in heap area should be incremented
-
getRetainedHeapSize
public long getRetainedHeapSize()
Get number of retained bytes in heap area this histogram record stands for.Retained bytes means how much memory would be garbage collected if the references to the objects this histogram record stands for would be lost and the objects garbage collected.
- Returns:
- number of retained bytes in heap area this histogram record stands for
-
setRetainedHeapSize
public void setRetainedHeapSize(long retainedHeapSize)
Set number of retained bytes in heap area this histogram record stands for.Retained bytes means how much memory would be garbage collected if the references to the objects this histogram record stands for would be lost and the objects garbage collected.
- Parameters:
retainedHeapSize- number of retained bytes in heap area this histogram record stands for
-
incRetainedHeapSize
public void incRetainedHeapSize(long inc)
-
reverseComparator
public static java.util.Comparator<HistogramRecord> reverseComparator(java.util.Comparator<HistogramRecord> comparator)
Convenience method reversing the order of the given comparator. Be aware that each time you call this method a new comparator is returned and that this comparator delegates the call to the given comparator, but just switches the parameters. You can get the same result with the given comparator, by iterating from the last to the first element instead. From performance perspective using e.g.List.get(int)is anyhow faster compared to anIterator.- Parameters:
comparator- comparator for which a reversed comparator should be returned- Returns:
- comparator comparing in reverse order than the given comparator
-
-