Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit cadcd51e authored by Andreas Gampe's avatar Andreas Gampe
Browse files

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 98f406f6)

Change-Id: I3785cc5715acadbee81ef7b45081ed780f1351d3
parent 5acb30de
Loading
Loading
Loading
Loading
+20 −0
Original line number Diff line number Diff line
@@ -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') {