HandleHeap

public final class HandleHeap
extends ChunkHandler

java.lang.Object
   ↳ com.android.tradefed.device.server.jdwp.JdwpInterceptor
     ↳ com.android.tradefed.device.server.jdwp.chunkhandler.ChunkHandler
       ↳ com.android.tradefed.device.server.jdwp.chunkhandler.HandleHeap


Handle heap status updates.

Summary

Constants

int HPIF_WHEN_EVERY_GC

int HPIF_WHEN_NEVER

int HPIF_WHEN_NEXT_GC

int HPIF_WHEN_NOW

int WHAT_MERGE

int WHAT_OBJ

int WHEN_DISABLE

int WHEN_GC

Fields

public static final int CHUNK_HPDS

public static final int CHUNK_HPDU

public static final int CHUNK_HPEN

public static final int CHUNK_HPGC

public static final int CHUNK_HPIF

public static final int CHUNK_HPSG

public static final int CHUNK_HPST

public static final int CHUNK_REAE

public static final int CHUNK_REAL

public static final int CHUNK_REAQ

Public methods

void clientDisconnected(ClientImpl client)

Client went away.

void clientReady(ClientImpl client)

Client is ready.

void handleChunk(ClientImpl client, int type, ByteBuffer data, boolean isReply, int msgId)

Chunk handler entry point.

static void register(MonitorThread mt)

Register for the packets we expect to get from the client.

static void sendHPDS(ClientImpl client)

Sends an HPDS request to the client.

static void sendHPDU(ClientImpl client, String fileName)

Sends an HPDU request to the client.

static void sendHPGC(ClientImpl client)

Sends an HPGC request to the client.

static void sendHPIF(ClientImpl client, int when)

Send an HPIF (HeaP InFo) request to the client.

static void sendHPSG(ClientImpl client, int when, int what)

Sends an HPSG (HeaP SeGment) request to the client.

static void sendREAE(ClientImpl client, boolean enable)

Sends a REAE (REcent Allocation Enable) request to the client.

static void sendREAL(ClientImpl client)

Sends a REAL (REcent ALlocation) request to the client.

static void sendREAQ(ClientImpl client)

Sends a REAQ (REcent Allocation Query) request to the client.

Constants

HPIF_WHEN_EVERY_GC

public static final int HPIF_WHEN_EVERY_GC

Constant Value: 3 (0x00000003)

HPIF_WHEN_NEVER

public static final int HPIF_WHEN_NEVER

Constant Value: 0 (0x00000000)

HPIF_WHEN_NEXT_GC

public static final int HPIF_WHEN_NEXT_GC

Constant Value: 2 (0x00000002)

HPIF_WHEN_NOW

public static final int HPIF_WHEN_NOW

Constant Value: 1 (0x00000001)

WHAT_MERGE

public static final int WHAT_MERGE

Constant Value: 0 (0x00000000)

WHAT_OBJ

public static final int WHAT_OBJ

Constant Value: 1 (0x00000001)

WHEN_DISABLE

public static final int WHEN_DISABLE

Constant Value: 0 (0x00000000)

WHEN_GC

public static final int WHEN_GC

Constant Value: 1 (0x00000001)

Fields

CHUNK_HPDS

public static final int CHUNK_HPDS

CHUNK_HPDU

public static final int CHUNK_HPDU

CHUNK_HPEN

public static final int CHUNK_HPEN

CHUNK_HPGC

public static final int CHUNK_HPGC

CHUNK_HPIF

public static final int CHUNK_HPIF

CHUNK_HPSG

public static final int CHUNK_HPSG

CHUNK_HPST

public static final int CHUNK_HPST

CHUNK_REAE

public static final int CHUNK_REAE

CHUNK_REAL

public static final int CHUNK_REAL

CHUNK_REAQ

public static final int CHUNK_REAQ

Public methods

clientDisconnected

public void clientDisconnected (ClientImpl client)

Client went away.

Parameters
client ClientImpl

clientReady

public void clientReady (ClientImpl client)

Client is ready.

Parameters
client ClientImpl

handleChunk

public void handleChunk (ClientImpl client, 
                int type, 
                ByteBuffer data, 
                boolean isReply, 
                int msgId)

Chunk handler entry point.

Parameters
client ClientImpl

type int

data ByteBuffer

isReply boolean

msgId int

register

public static void register (MonitorThread mt)

Register for the packets we expect to get from the client.

Parameters
mt MonitorThread

sendHPDS

public static void sendHPDS (ClientImpl client)

Sends an HPDS request to the client.

We will get an HPDS response when the heap dump has completed. On failure we get a generic failure response.

This is more expensive for the device than HPDU, because the entire heap dump is held in RAM instead of spooled out to a temp file. On the other hand, permission to write to /sdcard is not required.

Parameters
client ClientImpl

sendHPDU

public static void sendHPDU (ClientImpl client, 
                String fileName)

Sends an HPDU request to the client.

We will get an HPDU response when the heap dump has completed. On failure we get a generic failure response.

Parameters
client ClientImpl

fileName String: name of output file (on device)

sendHPGC

public static void sendHPGC (ClientImpl client)

Sends an HPGC request to the client.

Parameters
client ClientImpl

sendHPIF

public static void sendHPIF (ClientImpl client, 
                int when)

Send an HPIF (HeaP InFo) request to the client.

Parameters
client ClientImpl

when int

sendHPSG

public static void sendHPSG (ClientImpl client, 
                int when, 
                int what)

Sends an HPSG (HeaP SeGment) request to the client.

Parameters
client ClientImpl

when int

what int

sendREAE

public static void sendREAE (ClientImpl client, 
                boolean enable)

Sends a REAE (REcent Allocation Enable) request to the client.

Parameters
client ClientImpl

enable boolean

sendREAL

public static void sendREAL (ClientImpl client)

Sends a REAL (REcent ALlocation) request to the client.

Parameters
client ClientImpl

sendREAQ

public static void sendREAQ (ClientImpl client)

Sends a REAQ (REcent Allocation Query) request to the client.

Parameters
client ClientImpl