Package org.eclipse.mat.snapshot.query
Class PieFactory
java.lang.Object
org.eclipse.mat.snapshot.query.PieFactory
Helper class to create pie chart results for heap objects.
Usage:
public class PieQuery implements IQuery { @Argument public ISnapshot snapshot; public IResult execute(IProgressListener listener) throws Exception { PieFactory f = new PieFactory(snapshot); int[] topDominators = snapshot.getImmediateDominatedIds(-1); for (int ii = 0; ii < 5 && ii < topDominators.length; ii++) f.addSlice(topDominators[ii]); return f.build(); } }
- Since:
- 0.8
-
Constructor Summary
ConstructorDescriptionPieFactory
(long pieSize) Create a pie factory for objects.PieFactory
(ISnapshot snapshot) Create a pie factory for the given snapshot.PieFactory
(ISnapshot snapshot, long pieSize) Create a pie factory for the given snapshot. -
Method Summary
Modifier and TypeMethodDescriptionaddSlice
(int objectId) Create and add a new slice for the given object.Create and add a new slice for the given object.Create and add a new slice for the given object.Create and add a new slice for the given object.Create and add a new slice for the given object.Create and add a new slice for the given object.build()
Create and return the pie result object.
-
Constructor Details
-
PieFactory
Create a pie factory for the given snapshot. The size of the pie is the total heap sizeSnapshotInfo.getUsedHeapSize()
.- Parameters:
snapshot
-
-
PieFactory
Create a pie factory for the given snapshot.- Parameters:
snapshot
- snapshot containing the objectspieSize
- total size of the pie
-
PieFactory
public PieFactory(long pieSize) Create a pie factory for objects. Objects must be added either viaaddSlice(IObject)
oraddSlice(int, String, long, long)
methods.- Parameters:
pieSize
- total size of the pie
-
-
Method Details
-
addSlice
Create and add a new slice for the given object. The size of the slice is determined by the retained size.To use this method, one needs to pass a
ISnapshot
to the constructor.- Parameters:
objectId
- object id- Returns:
- a new slice
- Throws:
SnapshotException
-
addSlice
Create and add a new slice for the given object. The size of the slice is determined by the retained size.To use this method, one needs to pass a
ISnapshot
to the constructor.- Parameters:
objectId
- object idcolor
- Explicit color of the slice- Returns:
- a new slice
- Throws:
SnapshotException
- Since:
- 1.2
-
addSlice
Create and add a new slice for the given object. The size of the slice is determined by the retained size.- Parameters:
object
-- Returns:
- a new slice
-
addSlice
Create and add a new slice for the given object. The size of the slice is determined by the retained size.- Parameters:
object
-color
- Explicit color of the slice- Returns:
- a new slice
- Since:
- 1.2
-
addSlice
public IResultPie.Slice addSlice(int objectId, String label, long usedHeapSize, long retainedHeapSize) Create and add a new slice for the given object.- Parameters:
objectId
- object idlabel
- (optionally) a label describing the object (for display)usedHeapSize
- (optionally) the used heap size (for display)retainedHeapSize
- the retained size which determines the size of the slice- Returns:
- a new slice
-
addSlice
public IResultPie.Slice addSlice(int objectId, String label, long usedHeapSize, long retainedHeapSize, Color color) Create and add a new slice for the given object.- Parameters:
objectId
- object idlabel
- (optionally) a label describing the object (for display)usedHeapSize
- (optionally) the used heap size (for display)retainedHeapSize
- the retained size which determines the size of the slicecolor
- the color to use for the slice- Returns:
- a new slice
- Since:
- 1.2
-
build
Create and return the pie result object.- Returns:
- the pie result object
-