Add streaming method profiling support.
The goal is to allow DDMS to start/stop method profiling in apps that
don't have permission to write to /sdcard. Instead of writing the
profiling data to disk and then pulling it off, we just blast the whole
thing straight from memory.
This includes:
- New method tracing start call (startMethodTracingDdms).
- Rearrangement of existing VMDebug method tracing calls for sanity.
- Addition of "vector" chunk send function, with corresponding
update to the JDWP transport function.
- Reshuffled the method trace start interlock, which seemed racy.
- Post new method-trace-profiling-streaming feature to DDMS.
Also:
- Added an internal exception-throw function that allows a printf
format string, so we can put useful detail into exception messages.
For bug 2160407.
diff --git a/vm/Profile.h b/vm/Profile.h
index d5dbea2..7cac150 100644
--- a/vm/Profile.h
+++ b/vm/Profile.h
@@ -39,7 +39,6 @@
/*
* Method trace state. This is currently global. In theory we could make
* most of this per-thread.
- *
*/
typedef struct MethodTraceState {
/* these are set during VM init */
@@ -50,6 +49,7 @@
pthread_mutex_t startStopLock;
pthread_cond_t threadExitCond;
FILE* traceFile;
+ bool directToDdms;
int bufferSize;
int flags;
@@ -97,7 +97,7 @@
* Start/stop method tracing.
*/
void dvmMethodTraceStart(const char* traceFileName, int traceFd, int bufferSize,
- int flags);
+ int flags, bool directToDdms);
bool dvmIsMethodTraceActive(void);
void dvmMethodTraceStop(void);