public final class PieFactory extends Object
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(); } }
Constructor and Description |
---|
PieFactory(ISnapshot snapshot)
Create a pie factory for the given snapshot.
|
PieFactory(ISnapshot snapshot,
long pieSize)
Create a pie factory for the given snapshot.
|
PieFactory(long pieSize)
Create a pie factory for objects.
|
Modifier and Type | Method and Description |
---|---|
IResultPie.Slice |
addSlice(int objectId)
Create and add a new slice for the given object.
|
IResultPie.Slice |
addSlice(int objectId,
Color color)
Create and add a new slice for the given object.
|
IResultPie.Slice |
addSlice(int objectId,
String label,
long usedHeapSize,
long retainedHeapSize)
Create and add a new slice for the given object.
|
IResultPie.Slice |
addSlice(int objectId,
String label,
long usedHeapSize,
long retainedHeapSize,
Color color)
Create and add a new slice for the given object.
|
IResultPie.Slice |
addSlice(IObject object)
Create and add a new slice for the given object.
|
IResultPie.Slice |
addSlice(IObject object,
Color color)
Create and add a new slice for the given object.
|
IResultPie |
build()
Create and return the pie result object.
|
public PieFactory(ISnapshot snapshot)
SnapshotInfo.getUsedHeapSize()
.snapshot
- public PieFactory(ISnapshot snapshot, long pieSize)
snapshot
- snapshot containing the objectspieSize
- total size of the piepublic PieFactory(long pieSize)
addSlice(IObject)
or addSlice(int, String, long, long)
methods.pieSize
- total size of the piepublic IResultPie.Slice addSlice(int objectId) throws SnapshotException
To use this method, one needs to pass a ISnapshot
to the
constructor.
objectId
- object idSnapshotException
public IResultPie.Slice addSlice(int objectId, Color color) throws SnapshotException
To use this method, one needs to pass a ISnapshot
to the
constructor.
objectId
- object idcolor
- Explicit color of the sliceSnapshotException
public IResultPie.Slice addSlice(IObject object)
object
- public IResultPie.Slice addSlice(IObject object, Color color)
object
- color
- Explicit color of the slicepublic IResultPie.Slice addSlice(int objectId, String label, long usedHeapSize, long retainedHeapSize)
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 slicepublic IResultPie.Slice addSlice(int objectId, String label, long usedHeapSize, long retainedHeapSize, Color color)
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 slicepublic IResultPie build()