NativeAllocationInfo

public class NativeAllocationInfo
extends Object

java.lang.Object
   ↳ com.android.tradefed.device.server.NativeAllocationInfo


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.

Summary

Constants

String ALLOCATIONS_KW

String BEGIN_STACKTRACE_KW

String END_STACKTRACE_KW

String SIZE_KW

String TOTAL_SIZE_KW

Public constructors

NativeAllocationInfo(int size, int allocations)

Constructs a new NativeAllocationInfo.

Public methods

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.

getResolvedStackCall()

Returns the resolved stack call.

int getSize()

Returns the size of this allocation.

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( resolvedStackCall)

Sets the resolved stack call for this allocation.

boolean stackEquals(NativeAllocationInfo mi)
String toString()

Returns a string representation of the object.

Constants

ALLOCATIONS_KW

public static final String ALLOCATIONS_KW

Constant Value: "Allocations:"

BEGIN_STACKTRACE_KW

public static final String BEGIN_STACKTRACE_KW

Constant Value: "BeginStacktrace:"

END_STACKTRACE_KW

public static final String END_STACKTRACE_KW

Constant Value: "EndStacktrace"

SIZE_KW

public static final String SIZE_KW

Constant Value: "Size:"

TOTAL_SIZE_KW

public static final String TOTAL_SIZE_KW

Constant Value: "TotalSize:"

Public constructors

NativeAllocationInfo

public NativeAllocationInfo (int size, 
                int allocations)

Constructs a new NativeAllocationInfo.

Parameters
size int: The size of the allocations.

allocations int: the allocation count

Public methods

addStackCallAddress

public void addStackCallAddress (long address)

Adds a stack call address for this allocation.

Parameters
address long: The address to add.

equals

public boolean equals (Object obj)

Indicates whether some other object is "equal to" this one.

Parameters
obj Object: the reference object with which to compare.

Returns
boolean true if this object is equal to the obj argument; false otherwise.

getAllocationCount

public int getAllocationCount ()

Returns the allocation count.

Returns
int

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
NativeStackCallInfo a NativeStackCallInfo or null if the stack call has not been processed from the raw addresses.

getResolvedStackCall

public  getResolvedStackCall ()

Returns the resolved stack call.

Returns
An array of NativeStackCallInfo or null if the stack call was not resolved.

getSize

public int getSize ()

Returns the size of this allocation.

Returns
int

getStackCallAddresses

public  getStackCallAddresses ()

Returns the stack call of this allocation as raw addresses.

Returns
the list of addresses where the allocation happened.

hashCode

public int hashCode ()

Returns
int

isStackCallResolved

public boolean isStackCallResolved ()

Returns whether the stack call addresses have been resolved into NativeStackCallInfo objects.

Returns
boolean

isZygoteChild

public boolean isZygoteChild ()

Returns whether the allocation happened in a child of the zygote process.

Returns
boolean

setResolvedStackCall

public void setResolvedStackCall ( 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.

stackEquals

public boolean stackEquals (NativeAllocationInfo mi)

Parameters
mi NativeAllocationInfo

Returns
boolean

toString

public String toString ()

Returns a string representation of the object.

Returns
String

See also: