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

Commit 067eda5a authored by Carmen Jackson's avatar Carmen Jackson Committed by android-build-merger
Browse files

Merge "Atrace: Add the debug.atrace.user_initiated property." into pi-dev

am: 56f68366

Change-Id: Ie167672ae97f7c7d221afe127323e457505513b7
parents 471f39be 56f68366
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
@@ -58,6 +58,7 @@ using std::string;
#define MAX_SYS_FILES 10

const char* k_traceTagsProperty = "debug.atrace.tags.enableflags";
const char* k_userInitiatedTraceProperty = "debug.atrace.user_initiated";

const char* k_traceAppsNumberProperty = "debug.atrace.app_number";
const char* k_traceAppsPropertyTemplate = "debug.atrace.app_%d";
@@ -448,6 +449,16 @@ static bool setTraceOverwriteEnable(bool enable)
    return setKernelOptionEnable(k_tracingOverwriteEnablePath, enable);
}

// Set the user initiated trace property
static bool setUserInitiatedTraceProperty(bool enable)
{
    if (!android::base::SetProperty(k_userInitiatedTraceProperty, enable ? "1" : "")) {
        fprintf(stderr, "error setting user initiated strace system property\n");
        return false;
    }
    return true;
}

// Enable or disable kernel tracing.
static bool setTracingEnabled(bool enable)
{
@@ -841,6 +852,8 @@ static bool setUpKernelTracing()
{
    bool ok = true;

    ok &= setUserInitiatedTraceProperty(true);

    // Set up the tracing options.
    ok &= setCategoriesEnableFromFile(g_categoriesFile);
    ok &= setTraceOverwriteEnable(g_traceOverwrite);
@@ -888,6 +901,7 @@ static void cleanUpKernelTracing()
    setTraceBufferSizeKB(1);
    setPrintTgidEnableIfPresent(false);
    setKernelTraceFuncs(NULL);
    setUserInitiatedTraceProperty(false);
}

// Enable tracing in the kernel.