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

要忽略的 VM 暫時名稱。

公用建構函式

ClientData(ClientImpl client, int pid)

泛型建構函式。

公用方法

void addFeature(String feature)
void addNativeAllocation(NativeAllocationInfo allocInfo)

將新的 NativeAllocationInfo 新增至 ClientImpl

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 位元),如果不明或未設定,則傳回空值。

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

傳回使用的 VM 旗標,如果不明則傳回 null。

getMappedNativeLibraries()

傳回對應至這個用戶端記憶體的原生程式庫清單。

static ClientData.IMethodProfilingHandler getMethodProfilingHandler()
ClientData.MethodProfilingStatus getMethodProfilingStatus()

傳回方法剖析狀態。

getNativeAllocationList()

傳回 NativeAllocationInfo 清單。

ClientData.HeapData getNativeHeapData()

傳回原生程式碼的 HeapData 物件。

String getPackageName()

如果支援通訊協定,則傳回應用程式的實際套件名稱。

String getPendingHprofDump()

傳回正在寫入的裝置端 hprof 檔案路徑。

String getPendingMethodProfiling()

傳回正在寫入的裝置端方法剖析檔案路徑。

int getPid()

傳回程序 ID。

ThreadInfo getThread(int threadId)

依執行緒 ID 傳回 ThreadInfo

ThreadInfo[] getThreads()

ThreadInfo 物件的形式傳回執行緒清單。

int getTotalNativeMemory()

傳回原生記憶體總量。

int getUserId()

傳回用戶端的使用者 ID。

ClientData.HeapData getVmHeapData()

傳回 VM 的 HeapData 物件。

getVmHeapIds()

Returns an iterator over the list of known VM heap ids.

ClientData.HeapInfo getVmHeapInfo(int heapId)

傳回指定 VM 堆積的最新資訊值。

String getVmIdentifier()

傳回用戶端的 VM ID。

boolean hasFeature(String feature)

如果 ClientImpl 支援指定的 feature,則傳回 true

boolean hasPendingHprofDump()
boolean isNativeDebuggable()
boolean isValidUserId()

如果已設定這個用戶端的 User-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)

設定 VM ID。

常數

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

要忽略的 VM 暫時名稱。

常數值: "

"

公用建構函式

ClientData

public ClientData (ClientImpl client, 
                int pid)

泛型建構函式。

參數
client ClientImpl

pid int

公用方法

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 位元),如果不明或未設定,則傳回空值。

傳回
String

getAllocationStatus

public ClientData.AllocationTrackingStatus getAllocationStatus ()

傳回配置追蹤狀態。

傳回
ClientData.AllocationTrackingStatus

getAllocationTrackingHandler

public static ClientData.IAllocationTrackingHandler getAllocationTrackingHandler ()

傳回
ClientData.IAllocationTrackingHandler

getAllocations

public AllocationInfo[] getAllocations ()

傳回追蹤分配項目的清單。

傳回
AllocationInfo[]

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

getHprofData

public ClientData.HprofData getHprofData ()

傳回
ClientData.HprofData

getHprofDumpHandler

public static ClientData.IHprofDumpHandler getHprofDumpHandler ()

傳回
ClientData.IHprofDumpHandler

getJvmFlags

public String getJvmFlags ()

傳回使用的 VM 旗標,如果不明則傳回 null。

傳回
String

getMappedNativeLibraries

public  getMappedNativeLibraries ()

傳回這個用戶端在記憶體中對應的原生程式庫清單。

傳回

getMethodProfilingHandler

public static ClientData.IMethodProfilingHandler getMethodProfilingHandler ()

傳回
ClientData.IMethodProfilingHandler

getMethodProfilingStatus

public ClientData.MethodProfilingStatus getMethodProfilingStatus ()

傳回方法剖析狀態。

傳回
ClientData.MethodProfilingStatus

getNativeAllocationList

public  getNativeAllocationList ()

傳回 NativeAllocationInfo 清單。

傳回

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,則為該 ID;否則為 -1

getVmHeapData

public ClientData.HeapData getVmHeapData ()

傳回 VM 的 HeapData 物件。

傳回
ClientData.HeapData

getVmHeapIds

public  getVmHeapIds ()

傳回已知 VM 堆積 ID 清單的疊代器。

呼叫者必須在疊代時,對 ClientData 物件進行同步處理。

傳回
堆積 ID 清單的疊代器

getVmHeapInfo

public ClientData.HeapInfo getVmHeapInfo (int heapId)

傳回指定 VM 堆積的最新資訊值。

參數
heapId int:應傳回資訊的堆積

傳回
ClientData.HeapInfo 包含指定堆積資訊值的對應。如果堆積 ID 不明,則傳回 null

getVmIdentifier

public String getVmIdentifier ()

傳回用戶端 VM ID。

傳回
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 ()

如果已設定這個用戶端的 User-ID,則傳回 true。只有支援多位使用者的裝置,才會將使用者 ID 傳回 ddms。如果是其他/舊型裝置,則不會設定這項功能。

傳回
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)

設定 VM ID。

參數
ident String