com.google.monitoring.runtime.instrumentation
Interface Sampler


public interface Sampler

This interface describes a function that is used to sample an allocation.

Author:
jeremymanson@google.com (Jeremy Manson)

Method Summary
 void sampleAllocation(int count, String desc, Object newObj, long size)
          Determines whether the object currently being allocated, with the given size, should be traced.
 

Method Detail

sampleAllocation

void sampleAllocation(int count,
                      String desc,
                      Object newObj,
                      long size)
Determines whether the object currently being allocated, with the given size, should be traced. CAUTION: DO NOT DO ALLOCATION IN THIS METHOD WITHOUT ENSURING THAT THE SAMPLER WILL NOT BE INVOKED ON THE RESULTING ALLOCATION. Otherwise, you will get an infinite regress of calls to the sampler.

Parameters:
count - the int count of how many instances are being allocated. -1 means a simple new to distinguish from a 1-element array. 0 shows up as a value here sometimes; one reason is T[] toArray()-type methods that require an array type argument (see ArrayList.toArray() for example).
desc - the String descriptor of the class/primitive type being allocated.
newObj - the new Object whose allocation we're recording.
size - the size of the object being allocated.


Copyright © 2009-2011 Google, Inc.. All Rights Reserved.