public class Client extends JdwpAgent
This class gives access to basic client information, as well as methods to perform actions on the client.
More detailed information, usually updated in real time, can be access through the
ClientData
class. Each Client
object has its own ClientData
accessed through getClientData()
.
Modifier and Type | Field and Description |
---|---|
static int |
CHANGE_DEBUGGER_STATUS
Client change bit mask: debugger status change
|
static int |
CHANGE_HEAP_ALLOCATION_STATUS
Client change bit mask: allocation information updated
|
static int |
CHANGE_HEAP_ALLOCATIONS
Client change bit mask: allocation information updated
|
static int |
CHANGE_HEAP_DATA
Client change bit mask: head data updated
|
static int |
CHANGE_HEAP_MODE
Client change bit mask: heap update flag change
|
static int |
CHANGE_HPROF
Client change bit mask: hprof data updated
|
static int |
CHANGE_INFO
|
static int |
CHANGE_METHOD_PROFILING_STATUS
Client change bit mask: allocation information updated
|
static int |
CHANGE_NAME
Client change bit mask: application name change
|
static int |
CHANGE_NATIVE_HEAP_DATA
Client change bit mask: native heap data updated
|
static int |
CHANGE_PORT
Client change bit mask: debugger port change
|
static int |
CHANGE_THREAD_DATA
Client change bit mask: thread data updated
|
static int |
CHANGE_THREAD_MODE
Client change bit mask: thread update flag change
|
static int |
CHANGE_THREAD_STACKTRACE
Client change bit mask: thread stack trace updated
|
Modifier and Type | Method and Description |
---|---|
void |
dumpHprof()
Makes the VM dump an HPROF file
|
void |
enableAllocationTracker(boolean enable)
Enables or disables the Allocation tracker for this client.
|
void |
executeGarbageCollector()
Forces the client to execute its garbage collector.
|
ClientData |
getClientData()
Returns the
ClientData object containing this client information. |
Debugger |
getDebugger()
Return the Debugger object associated with this client.
|
int |
getDebuggerListenPort()
Returns the debugger port for this client.
|
IDevice |
getDevice()
Returns the
IDevice on which this Client is running. |
boolean |
isDdmAware()
Returns
true if the client VM is DDM-aware. |
boolean |
isDebuggerAttached()
Returns
true if a debugger is currently attached to the client. |
boolean |
isHeapUpdateEnabled()
Returns whether any heap update is enabled.
|
boolean |
isSelectedClient()
Returns whether this client is the current selected client, accepting debugger connection
on the "selected debugger port".
|
boolean |
isThreadUpdateEnabled()
Returns whether the thread update is enabled.
|
boolean |
isValid()
Returns whether this
Client has a valid connection to the application VM. |
void |
kill()
Sends a kill message to the VM.
|
void |
refreshName()
Refreshes the name data for a given Client.
|
void |
requestAllocationDetails()
Sends a request to the VM to send the information about all the allocations that have
happened since the call to
enableAllocationTracker(boolean) with enable
set to null . |
void |
requestAllocationStatus()
Sends a request to the VM to send the enable status of the allocation tracking.
|
void |
requestMethodProfilingStatus()
Sends a request to the VM to send the enable status of the method profiling.
|
boolean |
requestNativeHeapInformation()
Sends a native heap update request.
|
void |
requestThreadStackTrace(int threadId)
Sends a thread stack trace update request.
|
void |
requestThreadUpdate()
Sends a thread update request.
|
protected void |
send(JdwpPacket packet)
Send a DDM packet to the client.
|
void |
setAsSelectedClient()
Sets the client to accept debugger connection on the "selected debugger port".
|
void |
setHeapInfoUpdateEnabled(boolean enabled) |
void |
setHeapSegmentUpdateEnabled(boolean enabled) |
void |
setHeapUpdateEnabled(boolean enabled)
Enables or disables the heap update.
|
void |
setThreadUpdateEnabled(boolean enabled)
Enables or disables the thread update.
|
void |
startMethodTracer() |
boolean |
startOpenGlTracing() |
void |
startSamplingProfiler(int samplingInterval,
java.util.concurrent.TimeUnit timeUnit) |
void |
stopMethodTracer() |
boolean |
stopOpenGlTracing() |
void |
stopSamplingProfiler() |
void |
toggleMethodProfiling()
Deprecated.
|
java.lang.String |
toString()
Returns a string representation of the
Client object. |
void |
updateHeapInfo()
Fires a single heap update.
|
addJdwpInterceptor, addReplyInterceptor, clear, getJdwpProtocol, incoming, removeReplyInterceptor, send
public static final int CHANGE_NAME
public static final int CHANGE_DEBUGGER_STATUS
public static final int CHANGE_PORT
public static final int CHANGE_THREAD_MODE
public static final int CHANGE_THREAD_DATA
public static final int CHANGE_HEAP_MODE
public static final int CHANGE_HEAP_DATA
public static final int CHANGE_NATIVE_HEAP_DATA
public static final int CHANGE_THREAD_STACKTRACE
public static final int CHANGE_HEAP_ALLOCATIONS
public static final int CHANGE_HEAP_ALLOCATION_STATUS
public static final int CHANGE_METHOD_PROFILING_STATUS
public static final int CHANGE_HPROF
public static final int CHANGE_INFO
public java.lang.String toString()
Client
object.toString
in class java.lang.Object
public int getDebuggerListenPort()
public boolean isDdmAware()
true
if the client VM is DDM-aware.
Calling here is only allowed after the connection has been
established.public boolean isDebuggerAttached()
true
if a debugger is currently attached to the client.public Debugger getDebugger()
@NonNull public ClientData getClientData()
ClientData
object containing this client information.public void executeGarbageCollector()
public void dumpHprof()
@Deprecated public void toggleMethodProfiling()
startMethodTracer()
, stopMethodTracer()
,
startSamplingProfiler(int, java.util.concurrent.TimeUnit)
or
stopSamplingProfiler()
instead.public void startMethodTracer() throws java.io.IOException
java.io.IOException
public void stopMethodTracer() throws java.io.IOException
java.io.IOException
public void startSamplingProfiler(int samplingInterval, java.util.concurrent.TimeUnit timeUnit) throws java.io.IOException
java.io.IOException
public void stopSamplingProfiler() throws java.io.IOException
java.io.IOException
public boolean startOpenGlTracing()
public boolean stopOpenGlTracing()
public void requestMethodProfilingStatus()
The allocation status can be accessed by ClientData.getAllocationStatus()
.
The notification that the new status is available will be received through
AndroidDebugBridge.IClientChangeListener.clientChanged(Client, int)
with a changeMask
containing the mask CHANGE_HEAP_ALLOCATION_STATUS
.
public void setThreadUpdateEnabled(boolean enabled)
If true
the VM will be able to send thread information. Thread information
must be requested with requestThreadUpdate()
.
enabled
- the enable flag.public boolean isThreadUpdateEnabled()
public void requestThreadUpdate()
The thread info can be accessed by ClientData.getThreads()
. The notification
that the new data is available will be received through
AndroidDebugBridge.IClientChangeListener.clientChanged(Client, int)
with a changeMask
containing the mask CHANGE_THREAD_DATA
.
public void requestThreadStackTrace(int threadId)
The thread info can be accessed by ClientData.getThreads()
and
ThreadInfo.getStackTrace()
.
The notification that the new data is available
will be received through AndroidDebugBridge.IClientChangeListener.clientChanged(Client, int)
with a changeMask
containing the mask CHANGE_THREAD_STACKTRACE
.
public void setHeapUpdateEnabled(boolean enabled)
If true
, any GC will cause the client to send its heap information.
The heap information can be accessed by ClientData.getVmHeapData()
.
The notification that the new data is available
will be received through AndroidDebugBridge.IClientChangeListener.clientChanged(Client, int)
with a changeMask
containing the value CHANGE_HEAP_DATA
.
enabled
- the enable flagpublic void setHeapInfoUpdateEnabled(boolean enabled)
public void setHeapSegmentUpdateEnabled(boolean enabled)
public void updateHeapInfo()
public void refreshName() throws java.io.IOException
java.io.IOException
public boolean isHeapUpdateEnabled()
setHeapUpdateEnabled(boolean)
public boolean requestNativeHeapInformation()
The native heap info can be accessed by ClientData.getNativeAllocationList()
.
The notification that the new data is available will be received through
AndroidDebugBridge.IClientChangeListener.clientChanged(Client, int)
with a changeMask
containing the mask CHANGE_NATIVE_HEAP_DATA
.
public void enableAllocationTracker(boolean enable)
If enabled, the VM will start tracking allocation information. A call to
requestAllocationDetails()
will make the VM sends the information about all the
allocations that happened between the enabling and the request.
enable
- requestAllocationDetails()
public void requestAllocationStatus()
The allocation status can be accessed by ClientData.getAllocationStatus()
.
The notification that the new status is available will be received through
AndroidDebugBridge.IClientChangeListener.clientChanged(Client, int)
with a changeMask
containing the mask CHANGE_HEAP_ALLOCATION_STATUS
.
public void requestAllocationDetails()
enableAllocationTracker(boolean)
with enable
set to null
. This is asynchronous.
The allocation information can be accessed by ClientData.getAllocations()
.
The notification that the new data is available will be received through
AndroidDebugBridge.IClientChangeListener.clientChanged(Client, int)
with a changeMask
containing the mask CHANGE_HEAP_ALLOCATIONS
.
public void kill()
public void setAsSelectedClient()
public boolean isSelectedClient()
protected void send(@NonNull JdwpPacket packet) throws java.io.IOException
public boolean isValid()
Client
has a valid connection to the application VM.