Package org.eclipse.mat.snapshot
Class HistogramRecord
java.lang.Object
org.eclipse.mat.snapshot.HistogramRecord
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
ClassHistogramRecord
,ClassHistogramRecordBuilder
,ClassLoaderHistogramRecord
,ClassLoaderHistogramRecordBuilder
,Histogram
,HistogramBuilder
This 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:
-
Field Summary
Modifier and TypeFieldDescriptionstatic final Comparator<HistogramRecord>
static final Comparator<HistogramRecord>
static final Comparator<HistogramRecord>
static final Comparator<HistogramRecord>
-
Constructor Summary
ConstructorDescriptionHistogramRecord
(String label) Create histogram record just with a label identifying it.HistogramRecord
(String label, long numberOfObjects, long usedHeapSize, long retainedHeapSize) Create histogram record with a label identifying it and its basic data. -
Method Summary
Modifier and TypeMethodDescriptiongetLabel()
Get label identifying the histogram record.long
Get number of objects this histogram record stands for.long
Get number of retained bytes in heap area this histogram record stands for.long
Get number of bytes in heap area this histogram record stands for.void
Increment number of objects this histogram record stands for by 1.void
incNumberOfObjects
(long inc) Increment number of objects this histogram record stands for.void
incRetainedHeapSize
(long inc) void
incUsedHeapSize
(long inc) Increment number of bytes in heap area this histogram record stands for.static Comparator<HistogramRecord>
reverseComparator
(Comparator<HistogramRecord> comparator) Convenience method reversing the order of the given comparator.void
Set label identifying the histogram record.void
setNumberOfObjects
(long numberOfObjects) Set number of objects this histogram record stands for.void
setRetainedHeapSize
(long retainedHeapSize) Set number of retained bytes in heap area this histogram record stands for.void
setUsedHeapSize
(long usedHeapSize) Set number of bytes in heap area this histogram record stands for.
-
Field Details
-
COMPARATOR_FOR_LABEL
-
COMPARATOR_FOR_NUMBEROFOBJECTS
-
COMPARATOR_FOR_USEDHEAPSIZE
-
COMPARATOR_FOR_RETAINEDHEAPSIZE
-
-
Constructor Details
-
HistogramRecord
Create histogram record just with a label identifying it.- Parameters:
label
- label identifying the histogram record
-
HistogramRecord
public HistogramRecord(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 Details
-
getLabel
Get label identifying the histogram record.- Returns:
- label identifying the histogram record
-
setLabel
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
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
-