summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Hao <jeffhao@google.com>2013-08-28 01:14:26 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2013-08-28 01:14:26 +0000
commit6b34ab3f1aafc3143c71e342b7a9f5a6ddfeabb4 (patch)
tree97dbe5a70264ab5564f6098c11bdba4aa2a85980
parent366291e2830b96268458dd6c5b15412e46d93145 (diff)
parent6c7bac69f5e1096a93983817d6e093dd81fc7220 (diff)
downloadbase-6b34ab3f1aafc3143c71e342b7a9f5a6ddfeabb4.tar.gz
Merge "Merge MPSE and SPSE Chunk handlers for ddms."
-rw-r--r--core/java/android/ddm/DdmHandleProfiling.java47
1 files changed, 13 insertions, 34 deletions
diff --git a/core/java/android/ddm/DdmHandleProfiling.java b/core/java/android/ddm/DdmHandleProfiling.java
index e1d359c0aa0c..f4011eda89d8 100644
--- a/core/java/android/ddm/DdmHandleProfiling.java
+++ b/core/java/android/ddm/DdmHandleProfiling.java
@@ -37,6 +37,7 @@ public class DdmHandleProfiling extends ChunkHandler {
public static final int CHUNK_SPSS = type("SPSS");
public static final int CHUNK_SPSE = type("SPSE");
+ private static final boolean DEBUG = false;
private static DdmHandleProfiling mInstance = new DdmHandleProfiling();
@@ -72,7 +73,7 @@ public class DdmHandleProfiling extends ChunkHandler {
* Handle a chunk of data.
*/
public Chunk handleChunk(Chunk request) {
- if (false)
+ if (DEBUG)
Log.v("ddm-heap", "Handling " + name(request.type) + " chunk");
int type = request.type;
@@ -83,13 +84,13 @@ public class DdmHandleProfiling extends ChunkHandler {
} else if (type == CHUNK_MPSS) {
return handleMPSS(request);
} else if (type == CHUNK_MPSE) {
- return handleMPSE(request);
+ return handleMPSEOrSPSE(request, "Method");
} else if (type == CHUNK_MPRQ) {
return handleMPRQ(request);
} else if (type == CHUNK_SPSS) {
return handleSPSS(request);
} else if (type == CHUNK_SPSE) {
- return handleSPSE(request);
+ return handleMPSEOrSPSE(request, "Sample");
} else {
throw new RuntimeException("Unknown packet "
+ ChunkHandler.name(type));
@@ -106,7 +107,7 @@ public class DdmHandleProfiling extends ChunkHandler {
int flags = in.getInt();
int len = in.getInt();
String fileName = getString(in, len);
- if (false)
+ if (DEBUG)
Log.v("ddm-heap", "Method profiling start: filename='" + fileName
+ "', size=" + bufferSize + ", flags=" + flags);
@@ -146,7 +147,7 @@ public class DdmHandleProfiling extends ChunkHandler {
int bufferSize = in.getInt();
int flags = in.getInt();
- if (false) {
+ if (DEBUG) {
Log.v("ddm-heap", "Method prof stream start: size=" + bufferSize
+ ", flags=" + flags);
}
@@ -160,20 +161,18 @@ public class DdmHandleProfiling extends ChunkHandler {
}
/*
- * Handle a "Method Profiling w/Streaming End" request.
+ * Handle a "Method Profiling w/Streaming End" request or a
+ * "Sample Profiling w/Streaming End" request.
*/
- private Chunk handleMPSE(Chunk request) {
- byte result;
-
- if (false) {
- Log.v("ddm-heap", "Method prof stream end");
+ private Chunk handleMPSEOrSPSE(Chunk request, String type) {
+ if (DEBUG) {
+ Log.v("ddm-heap", type + " prof stream end");
}
try {
Debug.stopMethodTracing();
- result = 0;
} catch (RuntimeException re) {
- Log.w("ddm-heap", "Method prof stream end failed: "
+ Log.w("ddm-heap", type + " prof stream end failed: "
+ re.getMessage());
return createFailChunk(1, re.getMessage());
}
@@ -202,7 +201,7 @@ public class DdmHandleProfiling extends ChunkHandler {
int bufferSize = in.getInt();
int flags = in.getInt();
int interval = in.getInt();
- if (false) {
+ if (DEBUG) {
Log.v("ddm-heap", "Sample prof stream start: size=" + bufferSize
+ ", flags=" + flags + ", interval=" + interval);
}
@@ -214,25 +213,5 @@ public class DdmHandleProfiling extends ChunkHandler {
return createFailChunk(1, re.getMessage());
}
}
-
- /*
- * Handle a "Sample Profiling w/Streaming End" request.
- */
- private Chunk handleSPSE(Chunk request) {
- if (false) {
- Log.v("ddm-heap", "Sample prof stream end");
- }
-
- try {
- Debug.stopMethodTracing();
- } catch (RuntimeException re) {
- Log.w("ddm-heap", "Sample prof stream end failed: "
- + re.getMessage());
- return createFailChunk(1, re.getMessage());
- }
-
- /* VM sent the (perhaps very large) response directly */
- return null;
- }
}