com.android.ddmlib
Class NativeAllocationInfo

java.lang.Object
  extended by com.android.ddmlib.NativeAllocationInfo

public final class NativeAllocationInfo
extends Object

Stores native allocation information.

Contains number of allocations, their size and the stack trace.

Note: the ddmlib does not resolve the stack trace automatically. While this class provides storage for resolved stack trace, this is merely for convenience.


Field Summary
static String ALLOCATIONS_KW
           
static String BEGIN_STACKTRACE_KW
           
static String END_STACKTRACE_KW
           
static String SIZE_KW
           
static String TOTAL_SIZE_KW
           
 
Constructor Summary
NativeAllocationInfo(int size, int allocations)
          Constructs a new NativeAllocationInfo.
 
Method Summary
 void addStackCallAddress(long address)
          Adds a stack call address for this allocation.
 boolean equals(Object obj)
          Indicates whether some other object is "equal to" this one.
 int getAllocationCount()
          Returns the allocation count.
 NativeStackCallInfo getRelevantStackCallInfo()
          Returns the first NativeStackCallInfo that is relevant.
 List<NativeStackCallInfo> getResolvedStackCall()
          Returns the resolved stack call.
 int getSize()
          Returns the total size of this allocation.
 List<Long> getStackCallAddresses()
          Returns the stack call of this allocation as raw addresses.
 int hashCode()
           
 boolean isStackCallResolved()
          Returns whether the stack call addresses have been resolved into NativeStackCallInfo objects.
 boolean isZygoteChild()
          Returns whether the allocation happened in a child of the zygote process.
 void setResolvedStackCall(List<NativeStackCallInfo> resolvedStackCall)
          Sets the resolved stack call for this allocation.
 String toString()
          Returns a string representation of the object.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

END_STACKTRACE_KW

public static final String END_STACKTRACE_KW
See Also:
Constant Field Values

BEGIN_STACKTRACE_KW

public static final String BEGIN_STACKTRACE_KW
See Also:
Constant Field Values

TOTAL_SIZE_KW

public static final String TOTAL_SIZE_KW
See Also:
Constant Field Values

SIZE_KW

public static final String SIZE_KW
See Also:
Constant Field Values

ALLOCATIONS_KW

public static final String ALLOCATIONS_KW
See Also:
Constant Field Values
Constructor Detail

NativeAllocationInfo

public NativeAllocationInfo(int size,
                            int allocations)
Constructs a new NativeAllocationInfo.

Parameters:
size - The size of the allocations.
allocations - the allocation count
Method Detail

addStackCallAddress

public void addStackCallAddress(long address)
Adds a stack call address for this allocation.

Parameters:
address - The address to add.

getSize

public int getSize()
Returns the total size of this allocation.


isZygoteChild

public boolean isZygoteChild()
Returns whether the allocation happened in a child of the zygote process.


getAllocationCount

public int getAllocationCount()
Returns the allocation count.


isStackCallResolved

public boolean isStackCallResolved()
Returns whether the stack call addresses have been resolved into NativeStackCallInfo objects.


getStackCallAddresses

public List<Long> getStackCallAddresses()
Returns the stack call of this allocation as raw addresses.

Returns:
the list of addresses where the allocation happened.

setResolvedStackCall

public void setResolvedStackCall(List<NativeStackCallInfo> resolvedStackCall)
Sets the resolved stack call for this allocation.

If resolvedStackCall is non null then isStackCallResolved() will return true after this call.

Parameters:
resolvedStackCall - The list of NativeStackCallInfo.

getResolvedStackCall

public List<NativeStackCallInfo> getResolvedStackCall()
Returns the resolved stack call.

Returns:
An array of NativeStackCallInfo or null if the stack call was not resolved.
See Also:
#setResolvedStackCall(ArrayList), isStackCallResolved()

equals

public boolean equals(Object obj)
Indicates whether some other object is "equal to" this one.

Overrides:
equals in class Object
Parameters:
obj - the reference object with which to compare.
Returns:
true if this object is equal to the obj argument; false otherwise.
See Also:
Object.equals(java.lang.Object)

hashCode

public int hashCode()
Overrides:
hashCode in class Object

toString

public String toString()
Returns a string representation of the object.

Overrides:
toString in class Object
See Also:
Object.toString()

getRelevantStackCallInfo

public NativeStackCallInfo getRelevantStackCallInfo()
Returns the first NativeStackCallInfo that is relevant.

A relevant NativeStackCallInfo is a stack call that is not deep in the lower level of the libc, but the actual method that performed the allocation.

Returns:
a NativeStackCallInfo or null if the stack call has not been processed from the raw addresses.
See Also:
#setResolvedStackCall(ArrayList), isStackCallResolved()


Copyright © 2008-2012. All Rights Reserved.