Class AllocationRecorder
- java.lang.Object
-
- com.google.monitoring.runtime.instrumentation.AllocationRecorder
-
public class AllocationRecorder extends java.lang.ObjectThe logic for recording allocations, called from bytecode rewritten byAllocationInstrumenter.
-
-
Constructor Summary
Constructors Constructor Description AllocationRecorder()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidaddSampler(Sampler sampler)Adds aSamplerthat will get run every time an allocation is performed from Java code.static voidrecordAllocation(int count, java.lang.String desc, java.lang.Object newObj)Records the allocation.static voidrecordAllocation(java.lang.Class<?> cls, java.lang.Object newObj)static voidremoveSampler(Sampler sampler)Removes the givenSampler.
-
-
-
Method Detail
-
addSampler
public static void addSampler(Sampler sampler)
Adds aSamplerthat will get run every time an allocation is performed from Java code. Use this with extreme judiciousness!- Parameters:
sampler- The sampler to add.
-
removeSampler
public static void removeSampler(Sampler sampler)
Removes the givenSampler.- Parameters:
sampler- The sampler to remove.
-
recordAllocation
public static void recordAllocation(java.lang.Class<?> cls, java.lang.Object newObj)
-
recordAllocation
public static void recordAllocation(int count, java.lang.String desc, java.lang.Object newObj)Records the allocation. This method is invoked on every allocation performed by the system.- Parameters:
count- the count of how many instances are being allocated, if an array is being allocated. If an array is not being allocated, then this value will be -1.desc- the descriptor of the class/primitive type being allocated.newObj- the newObjectwhose allocation is being recorded.
-
-