From cadcd51e0548b21adc4c3e6bd6e31d5e4ee591c1 Mon Sep 17 00:00:00 2001 From: Andreas Gampe Date: Mon, 22 Jun 2015 21:09:36 -0700 Subject: [PATCH] Frameworks/base: Add tracing system properties Add system properties to support zygote-started method tracing. These are needed as the limit on system properties does not allow the reuse of the runtime extra options system property. Bug: 21760614 (cherry picked from commit 98f406f6f31660d0f5ee32113ffadc720b426dc6) Change-Id: I3785cc5715acadbee81ef7b45081ed780f1351d3 --- core/jni/AndroidRuntime.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/core/jni/AndroidRuntime.cpp b/core/jni/AndroidRuntime.cpp index 6e8da65ad62a..f73c142e574e 100644 --- a/core/jni/AndroidRuntime.cpp +++ b/core/jni/AndroidRuntime.cpp @@ -587,6 +587,8 @@ int AndroidRuntime::startVm(JavaVM** pJavaVM, JNIEnv** pEnv) char lockProfThresholdBuf[sizeof("-Xlockprofthreshold:")-1 + PROPERTY_VALUE_MAX]; char nativeBridgeLibrary[sizeof("-XX:NativeBridge=") + PROPERTY_VALUE_MAX]; char cpuAbiListBuf[sizeof("--cpu-abilist=") + PROPERTY_VALUE_MAX]; + char methodTraceFileBuf[sizeof("-Xmethod-trace-file:") + PROPERTY_VALUE_MAX]; + char methodTraceFileSizeBuf[sizeof("-Xmethod-trace-file-size:") + PROPERTY_VALUE_MAX]; bool checkJni = false; property_get("dalvik.vm.checkjni", propBuf, ""); @@ -847,6 +849,24 @@ int AndroidRuntime::startVm(JavaVM** pJavaVM, JNIEnv** pEnv) profileMaxStackDepth, "-Xprofile-max-stack-depth:"); + /* + * Tracing options. + */ + property_get("dalvik.vm.method-trace", propBuf, "false"); + if (strcmp(propBuf, "true") == 0) { + addOption("-Xmethod-trace"); + parseRuntimeOption("dalvik.vm.method-trace-file", + methodTraceFileBuf, + "-Xmethod-trace-file:"); + parseRuntimeOption("dalvik.vm.method-trace-file-siz", + methodTraceFileSizeBuf, + "-Xmethod-trace-file-size:"); + property_get("dalvik.vm.method-trace-stream", propBuf, "false"); + if (strcmp(propBuf, "true") == 0) { + addOption("-Xmethod-trace-stream"); + } + } + // Native bridge library. "0" means that native bridge is disabled. property_get("ro.dalvik.vm.native.bridge", propBuf, ""); if (propBuf[0] == '\0') { -- 2.11.0