summaryrefslogtreecommitdiffstats
path: root/runtime/instrumentation.h
diff options
context:
space:
mode:
authorAndreas Gampe <agampe@google.com>2015-02-27 12:49:04 -0800
committerAndreas Gampe <agampe@google.com>2015-04-15 20:45:35 -0700
commit40da286d3207d88ed8ff3f5caac4873874603428 (patch)
tree3f9720425b2a024a5a54a0a71447dcea107229a8 /runtime/instrumentation.h
parent6508158f8388847f4cc3693e2cc1dbee6c2c7d18 (diff)
downloadart-40da286d3207d88ed8ff3f5caac4873874603428.zip
art-40da286d3207d88ed8ff3f5caac4873874603428.tar.gz
art-40da286d3207d88ed8ff3f5caac4873874603428.tar.bz2
ART: Streaming trace mode
Add a streaming mode for tracing. Streaming uses a buffer of 16KB and writes to the output when that buffer gets full. Streaming mode can be enabled with -Xmethod-trace-stream and is currently not exposed otherwise. Add a python script that can parse the streaming format, which simply contains strings for newly encountered threads and methods inline, and create output that can be used with traceview. Add Trace::Pause and Trace::Abort, which can pause and abort tracing. Abort is different from Stop in that it does not write the data. Add code to the zygote hooks JNI implementation that pauses tracing before the fork, making sure that a child cannot clobber the parent's data. Add code to the zygote hooks JNI implementation that aborts old tracing and starts new tracing in the child after the fork. Currently base the output on the pid. This will not work on an unmodified device, as the profiles directory is not generally writable, but we do not have enough information at that point. Consider a scheme that restarts tracing later. Change-Id: I93c7bf87e35af582bdfdd3ecc7c52454514220dd
Diffstat (limited to 'runtime/instrumentation.h')
-rw-r--r--runtime/instrumentation.h8
1 files changed, 7 insertions, 1 deletions
diff --git a/runtime/instrumentation.h b/runtime/instrumentation.h
index 41821a6..8b7fcca 100644
--- a/runtime/instrumentation.h
+++ b/runtime/instrumentation.h
@@ -49,6 +49,11 @@ enum InterpreterHandlerTable {
kNumHandlerTables
};
+// Do we want to deoptimize for method entry and exit listeners or just try to intercept
+// invocations? Deoptimization forces all code to run in the interpreter and considerably hurts the
+// application's performance.
+static constexpr bool kDeoptimizeForAccurateMethodEntryExitListeners = true;
+
// Instrumentation event listener API. Registered listeners will get the appropriate call back for
// the events they are listening for. The call backs supply the thread, method and dex_pc the event
// occurred upon. The thread may or may not be Thread::Current().
@@ -170,7 +175,8 @@ class Instrumentation {
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
// Enable method tracing by installing instrumentation entry/exit stubs.
- void EnableMethodTracing()
+ void EnableMethodTracing(
+ bool require_interpreter = kDeoptimizeForAccurateMethodEntryExitListeners)
EXCLUSIVE_LOCKS_REQUIRED(Locks::mutator_lock_)
LOCKS_EXCLUDED(Locks::thread_list_lock_, Locks::classlinker_classes_lock_);