/* * Handle notification of completion of a HeaP DUmp. */ private void handleHPDU(Client client, ByteBuffer data) { // get the filename and make the client not have pending HPROF dump anymore. string filename = client.clientData.pendingHprofDump; client.clientData.pendingHprofDump = null; // get the dump result var result = data.get(); // get the app-level handler for HPROF dump ClientData.IHprofDumpHandler handler = ClientData.hprofDumpHandler; if (handler != null) { if (result == 0) { handler.onSuccess(filename, client); Log.d("ddm-heap", "Heap dump request has finished"); } else { handler.onEndFailure(client, null); Log.w("ddm-heap", "Heap dump request failed (check device log)"); } } }
/* * Handle HeaP Dump Streaming response. "data" contains the full * hprof dump. */ private void handleHPDS(Client client, ByteBuffer data) { ClientData.IHprofDumpHandler handler = ClientData.hprofDumpHandler; if (handler != null) { var stuff = new byte[data.capacity]; data.get(stuff, 0, stuff.Length); Log.d("ddm-hprof", "got hprof file, size: " + data.capacity + " bytes"); handler.onSuccess(stuff, client); } }