ClientData
public
class
ClientData
extends Object
| java.lang.Object | |
| ↳ | com.android.tradefed.device.server.ClientData |
包含 ClientImpl 的数据。
摘要
嵌套类 | |
|---|---|
class |
ClientData.HeapData
堆信息。 |
class |
ClientData.HeapInfo
|
class |
ClientData.HprofData
|
interface |
ClientData.IAllocationTrackingHandler
|
interface |
ClientData.IHprofDumpHandler
能够处理 HPROF 转储的处理程序。 |
interface |
ClientData.IMethodProfilingHandler
能够根据方法性能剖析信息采取行动的处理程序 |
class |
ClientData.Names
|
常量 | |
|---|---|
String |
FEATURE_HPROF
用于允许转储 hprof 文件的功能字符串 |
String |
FEATURE_HPROF_STREAMING
用于允许直接流式传输 hprof 转储的功能的字符串 |
String |
FEATURE_OPENGL_TRACING
用于指示支持跟踪 OpenGL 调用的功能字符串。 |
String |
FEATURE_PROFILING
用于启用/停用方法分析的功能的字符串 |
String |
FEATURE_PROFILING_STREAMING
用于启用方法分析数据直接流式传输的字符串 |
String |
FEATURE_SAMPLING_PROFILER
用于启用抽样分析器的功能字符串。 |
String |
FEATURE_VIEW_HIERARCHY
用于表示支持提供视图层次结构的字符串。 |
String |
PRE_INITIALIZED
要忽略的虚拟机的临时名称。 |
公共构造函数 | |
|---|---|
ClientData(ClientImpl client, int pid)
通用构造函数。 |
|
公共方法 | |
|---|---|
void
|
addFeature(String feature)
|
void
|
addNativeAllocation(NativeAllocationInfo allocInfo)
向 |
void
|
addNativeLibraryMapInfo(long startAddr, long endAddr, String library)
|
void
|
addThread(int threadId, String threadName)
向列表添加新线程。 |
void
|
clearHprofData()
|
void
|
clearNativeAllocationInfo()
清除当前的 malloc 信息。 |
void
|
clearThreads()
|
String
|
getAbi()
返回应用的 ABI 风味(32 位或 64 位),如果未知或未设置,则返回 null。 |
ClientData.AllocationTrackingStatus
|
getAllocationStatus()
返回分配跟踪状态。 |
static
ClientData.IAllocationTrackingHandler
|
getAllocationTrackingHandler()
|
AllocationInfo[]
|
getAllocations()
返回跟踪的分配列表。 |
byte[]
|
getAllocationsData()
返回跟踪分配的原始数据。 |
String
|
getClientDescription()
返回客户端说明。 |
String
|
getDataDir()
返回应用的数据目录。 |
ClientData.DebuggerStatus
|
getDebuggerConnectionStatus()
返回调试器连接状态。 |
ClientData.HprofData
|
getHprofData()
|
static
ClientData.IHprofDumpHandler
|
getHprofDumpHandler()
|
String
|
getJvmFlags()
返回正在使用的虚拟机标志,如果未知,则返回 null。 |
|
getMappedNativeLibraries()
返回此客户端在内存中映射的本地库列表。 |
static
ClientData.IMethodProfilingHandler
|
getMethodProfilingHandler()
|
ClientData.MethodProfilingStatus
|
getMethodProfilingStatus()
返回方法分析状态。 |
|
getNativeAllocationList()
返回 |
ClientData.HeapData
|
getNativeHeapData()
返回原生代码的 |
String
|
getPackageName()
如果存在协议支持,则返回应用的实际软件包名称。 |
String
|
getPendingHprofDump()
返回正在写入的设备端 hprof 文件的路径。 |
String
|
getPendingMethodProfiling()
返回正在写入的设备端方法分析文件的路径。 |
int
|
getPid()
返回进程 ID。 |
ThreadInfo
|
getThread(int threadId)
按线程 ID 返回 |
ThreadInfo[]
|
getThreads()
以 |
int
|
getTotalNativeMemory()
返回总原生内存。 |
int
|
getUserId()
返回客户端的用户 ID。 |
ClientData.HeapData
|
getVmHeapData()
返回虚拟机的 |
|
getVmHeapIds()
返回已知虚拟机堆 ID 列表的迭代器。 |
ClientData.HeapInfo
|
getVmHeapInfo(int heapId)
返回指定虚拟机堆的最新的信息值。 |
String
|
getVmIdentifier()
返回客户端的虚拟机标识符。 |
boolean
|
hasFeature(String feature)
如果 |
boolean
|
hasPendingHprofDump()
|
boolean
|
isNativeDebuggable()
|
boolean
|
isValidUserId()
如果已设置相应客户端的用户 ID,则返回 true。 |
void
|
removeThread(int threadId)
从列表中移除线程。 |
void
|
setAbi(String abi)
|
void
|
setAllocationStatus(ClientData.AllocationTrackingStatus status)
|
static
void
|
setAllocationTrackingHandler(ClientData.IAllocationTrackingHandler handler)
此方法已被弃用。 |
void
|
setAllocationsData(byte[] data)
|
void
|
setDebuggerConnectionStatus(ClientData.DebuggerStatus status)
设置调试器连接状态。 |
void
|
setHeapInfo(int heapId, long maxSizeInBytes, long sizeInBytes, long bytesAllocated, long objectsAllocated, long timeStamp, byte reason)
为指定堆设置当前堆信息值。 |
void
|
setHprofData(String filename)
|
void
|
setHprofData(byte[] data)
|
static
void
|
setHprofDumpHandler(ClientData.IHprofDumpHandler handler)
设置处理程序以在 HPROF 转储成功或失败时接收通知。 |
void
|
setJvmFlags(String jvmFlags)
|
static
void
|
setMethodProfilingHandler(ClientData.IMethodProfilingHandler handler)
设置处理程序以在 HPROF 转储成功或失败时接收通知。 |
void
|
setMethodProfilingStatus(ClientData.MethodProfilingStatus status)
|
void
|
setNames(ClientData.Names names)
设置进程、用户 ID(即 |
void
|
setNativeDebuggable(boolean nativeDebuggable)
|
void
|
setPendingHprofDump(String pendingHprofDump)
设置正在写入的 hprof 文件的设备端路径 |
void
|
setPendingMethodProfiling(String pendingMethodProfiling)
设置正在写入的方法配置文件在设备端的路径 |
void
|
setTotalNativeMemory(int totalMemory)
|
void
|
setVmIdentifier(String ident)
设置虚拟机标识符。 |
常量
FEATURE_HPROF
public static final String FEATURE_HPROF
用于允许转储 hprof 文件的功能的字符串
常量值: "hprof-heap-dump"
FEATURE_HPROF_STREAMING
public static final String FEATURE_HPROF_STREAMING
用于允许直接流式传输 hprof 转储的功能的字符串
常量值: "hprof-heap-dump-streaming"
FEATURE_OPENGL_TRACING
public static final String FEATURE_OPENGL_TRACING
用于指示支持跟踪 OpenGL 调用的功能的字符串。
常量值: "opengl-tracing"
FEATURE_PROFILING
public static final String FEATURE_PROFILING
用于启用/停止方法分析的功能的字符串
常量值: “method-trace-profiling”
FEATURE_PROFILING_STREAMING
public static final String FEATURE_PROFILING_STREAMING
用于启用方法分析数据直接流式传输的字符串
常量值: “method-trace-profiling-streaming”
FEATURE_SAMPLING_PROFILER
public static final String FEATURE_SAMPLING_PROFILER
用于启用采样分析器的字符串。
常量值: “method-sample-profiling”
FEATURE_VIEW_HIERARCHY
public static final String FEATURE_VIEW_HIERARCHY
用于表示支持提供视图层次结构的字符串。
常量值: "view-hierarchy"
PRE_INITIALIZED
public static final String PRE_INITIALIZED
要忽略的虚拟机的临时名称。
常量值: "
公共构造函数
公共方法
addFeature
public void addFeature (String feature)
| 参数 | |
|---|---|
feature |
String |
addNativeAllocation
public void addNativeAllocation (NativeAllocationInfo allocInfo)
向 ClientImpl 添加新的 NativeAllocationInfo
| 参数 | |
|---|---|
allocInfo |
NativeAllocationInfo:要添加的 NativeAllocationInfo。 |
addNativeLibraryMapInfo
public void addNativeLibraryMapInfo (long startAddr,
long endAddr,
String library)| 参数 | |
|---|---|
startAddr |
long |
endAddr |
long |
library |
String |
addThread
public void addThread (int threadId,
String threadName)向列表添加新线程。
| 参数 | |
|---|---|
threadId |
int |
threadName |
String |
clearHprofData
public void clearHprofData ()
clearNativeAllocationInfo
public void clearNativeAllocationInfo ()
清除当前的 malloc 信息。
clearThreads
public void clearThreads ()
getAbi
public String getAbi ()
返回应用的 ABI 风味(32 位或 64 位),如果未知或未设置,则返回 null。
| 返回 | |
|---|---|
String |
|
getAllocationStatus
public ClientData.AllocationTrackingStatus getAllocationStatus ()
返回分配跟踪状态。
| 返回 | |
|---|---|
ClientData.AllocationTrackingStatus |
|
getAllocationTrackingHandler
public static ClientData.IAllocationTrackingHandler getAllocationTrackingHandler ()
| 返回 | |
|---|---|
ClientData.IAllocationTrackingHandler |
|
getAllocationsData
public byte[] getAllocationsData ()
返回跟踪分配的原始数据。
| 返回 | |
|---|---|
byte[] |
|
getClientDescription
public String getClientDescription ()
返回客户端说明。
这通常是在 AndroidManifest.xml 中定义的软件包的名称。
| 返回 | |
|---|---|
String |
客户端说明或 null(如果客户端尚未发送说明)。 |
getDataDir
public String getDataDir ()
返回应用的数据目录。
| 返回 | |
|---|---|
String |
|
getDebuggerConnectionStatus
public ClientData.DebuggerStatus getDebuggerConnectionStatus ()
返回调试器连接状态。
| 返回 | |
|---|---|
ClientData.DebuggerStatus |
|
getHprofDumpHandler
public static ClientData.IHprofDumpHandler getHprofDumpHandler ()
| 返回 | |
|---|---|
ClientData.IHprofDumpHandler |
|
getJvmFlags
public String getJvmFlags ()
返回正在使用的虚拟机标志,如果未知,则返回 null。
| 返回 | |
|---|---|
String |
|
getMappedNativeLibraries
publicgetMappedNativeLibraries ()
返回此客户端在内存中映射的本地库列表。
| 返回 | |
|---|---|
|
|
getMethodProfilingHandler
public static ClientData.IMethodProfilingHandler getMethodProfilingHandler ()
| 返回 | |
|---|---|
ClientData.IMethodProfilingHandler |
|
getMethodProfilingStatus
public ClientData.MethodProfilingStatus getMethodProfilingStatus ()
返回方法分析状态。
| 返回 | |
|---|---|
ClientData.MethodProfilingStatus |
|
getNativeHeapData
public ClientData.HeapData getNativeHeapData ()
返回原生代码的 HeapData 对象。
| 返回 | |
|---|---|
ClientData.HeapData |
|
getPackageName
public String getPackageName ()
如果存在协议支持,则返回应用的实际软件包名称。如果没有协议支持,则返回尝试从应用名称派生的软件包名称(以保持向后兼容性),如果派生不成功,则返回应用名称。
| 返回 | |
|---|---|
String |
|
getPendingHprofDump
public String getPendingHprofDump ()
返回正在写入的设备端 hprof 文件的路径。
| 返回 | |
|---|---|
String |
|
getPendingMethodProfiling
public String getPendingMethodProfiling ()
返回正在写入的设备端方法分析文件的路径。
| 返回 | |
|---|---|
String |
|
getPid
public int getPid ()
返回进程 ID。
| 返回 | |
|---|---|
int |
|
getThread
public ThreadInfo getThread (int threadId)
按线程 ID 返回 ThreadInfo。
| 参数 | |
|---|---|
threadId |
int |
| 返回 | |
|---|---|
ThreadInfo |
|
getThreads
public ThreadInfo[] getThreads ()
以 ThreadInfo 对象的形式返回线程列表。
在通过 ClientImpl.requestThreadUpdate() 请求更新线程之前,该列表为空。
| 返回 | |
|---|---|
ThreadInfo[] |
|
getTotalNativeMemory
public int getTotalNativeMemory ()
返回总原生内存。
| 返回 | |
|---|---|
int |
|
getUserId
public int getUserId ()
返回客户端的用户 ID。
| 返回 | |
|---|---|
int |
如果已设置,则为用户 ID;否则为 -1 |
getVmHeapData
public ClientData.HeapData getVmHeapData ()
返回虚拟机的 HeapData 对象。
| 返回 | |
|---|---|
ClientData.HeapData |
|
getVmHeapInfo
public ClientData.HeapInfo getVmHeapInfo (int heapId)
返回指定虚拟机堆的最新信息值。
| 参数 | |
|---|---|
heapId |
int:应返回信息的堆 |
| 返回 | |
|---|---|
ClientData.HeapInfo |
一个包含指定堆的信息值的映射。如果堆 ID 未知,则返回 null。 |
getVmIdentifier
public String getVmIdentifier ()
返回客户端的虚拟机标识符。
| 返回 | |
|---|---|
String |
|
hasFeature
public boolean hasFeature (String feature)
如果 ClientImpl 支持给定的 feature,则返回 true
| 参数 | |
|---|---|
feature |
String:要测试的功能。 |
| 返回 | |
|---|---|
boolean |
如果支持相应功能,则为 true |
hasPendingHprofDump
public boolean hasPendingHprofDump ()
| 返回 | |
|---|---|
boolean |
|
isNativeDebuggable
public boolean isNativeDebuggable ()
| 返回 | |
|---|---|
boolean |
|
isValidUserId
public boolean isValidUserId ()
如果已设置相应客户端的用户 ID,则返回 true。只有支持多用户的设备才会实际向 ddms 返回用户 ID。对于其他/旧版设备,此值不会设置。
| 返回 | |
|---|---|
boolean |
|
removeThread
public void removeThread (int threadId)
从列表中移除线程。
| 参数 | |
|---|---|
threadId |
int |
setAbi
public void setAbi (String abi)
| 参数 | |
|---|---|
abi |
String |
setAllocationStatus
public void setAllocationStatus (ClientData.AllocationTrackingStatus status)
| 参数 | |
|---|---|
status |
ClientData.AllocationTrackingStatus |
setAllocationTrackingHandler
public static void setAllocationTrackingHandler (ClientData.IAllocationTrackingHandler handler)
此方法已被弃用。请向 AndroidDebugBridge.addClientChangeListener(com.android.tradefed.device.server.AndroidDebugBridge.IClientChangeListener) 注册 AndroidDebugBridge.IClientChangeListener
| 参数 | |
|---|---|
handler |
ClientData.IAllocationTrackingHandler |
setAllocationsData
public void setAllocationsData (byte[] data)
| 参数 | |
|---|---|
data |
byte |
setDebuggerConnectionStatus
public void setDebuggerConnectionStatus (ClientData.DebuggerStatus status)
设置调试器连接状态。
| 参数 | |
|---|---|
status |
ClientData.DebuggerStatus |
setHeapInfo
public void setHeapInfo (int heapId,
long maxSizeInBytes,
long sizeInBytes,
long bytesAllocated,
long objectsAllocated,
long timeStamp,
byte reason)为指定堆设置当前堆信息值。
| 参数 | |
|---|---|
heapId |
int:要更新信息的堆 |
maxSizeInBytes |
long |
sizeInBytes |
long:堆的大小(以字节为单位) |
bytesAllocated |
long:堆中当前分配的字节数 |
objectsAllocated |
long:当前在 |
setHprofData
public void setHprofData (String filename)
| 参数 | |
|---|---|
filename |
String |
setHprofData
public void setHprofData (byte[] data)
| 参数 | |
|---|---|
data |
byte |
setHprofDumpHandler
public static void setHprofDumpHandler (ClientData.IHprofDumpHandler handler)
设置处理程序,以在 HPROF 转储成功或失败时接收通知。此方法已弃用,请注册客户端监听器并监听 CHANGE_HPROF。
| 参数 | |
|---|---|
handler |
ClientData.IHprofDumpHandler |
setJvmFlags
public void setJvmFlags (String jvmFlags)
| 参数 | |
|---|---|
jvmFlags |
String |
setMethodProfilingHandler
public static void setMethodProfilingHandler (ClientData.IMethodProfilingHandler handler)
设置处理程序,以在 HPROF 转储成功或失败时接收通知。此方法已弃用,请注册客户端监听器并监听 CHANGE_HPROF。
| 参数 | |
|---|---|
handler |
ClientData.IMethodProfilingHandler |
setMethodProfilingStatus
public void setMethodProfilingStatus (ClientData.MethodProfilingStatus status)
| 参数 | |
|---|---|
status |
ClientData.MethodProfilingStatus |
setNames
public void setNames (ClientData.Names names)
设置进程、用户 ID(即个人资料与工作资料)和软件包名称。
HELO 和 APNM 之间可能存在竞态条件。我们不会尝试在设备上强制执行排序,而是不允许预初始化的名称替换指定的名称。
| 参数 | |
|---|---|
names |
ClientData.Names |
setNativeDebuggable
public void setNativeDebuggable (boolean nativeDebuggable)
| 参数 | |
|---|---|
nativeDebuggable |
boolean |
setPendingHprofDump
public void setPendingHprofDump (String pendingHprofDump)
设置正在写入的 hprof 文件的设备端路径
| 参数 | |
|---|---|
pendingHprofDump |
String:hprof 文件的文件 |
setPendingMethodProfiling
public void setPendingMethodProfiling (String pendingMethodProfiling)
设置正在写入的方法配置文件在设备端的路径
| 参数 | |
|---|---|
pendingMethodProfiling |
String:正在写入的文件 |
setTotalNativeMemory
public void setTotalNativeMemory (int totalMemory)
| 参数 | |
|---|---|
totalMemory |
int |
setVmIdentifier
public void setVmIdentifier (String ident)
设置虚拟机标识符。
| 参数 | |
|---|---|
ident |
String |