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

Commit 13cebf32 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "profcollect: Switch to the new API with custom tag and duration" into main

parents 305f6e3d c1fcab24
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -291,7 +291,7 @@ public final class ProfcollectForwardingService extends SystemService {
                            "collection_interval", 600);
                    mScheduledExecutorService.scheduleWithFixedDelay(() -> {
                        if (sIProfcollect != null) {
                            Utils.traceSystem(sIProfcollect, "periodic");
                            Utils.traceSystem(sIProfcollect, "periodic", /* durationMs */ 0);
                        }
                    }, 0, interval, TimeUnit.SECONDS);
                    // Background process and upload service.
@@ -373,7 +373,7 @@ public final class ProfcollectForwardingService extends SystemService {
        @Override
        public void onIntentStarted(Intent intent, long timestampNanos) {
            if (Utils.withFrequency("applaunch_trace_freq", 5)) {
                Utils.traceSystem(sIProfcollect, "applaunch");
                Utils.traceSystem(sIProfcollect, "applaunch", /* durationMs */ 0);
            }
        }
    }
@@ -393,7 +393,7 @@ public final class ProfcollectForwardingService extends SystemService {
    private void traceOnDex2oatStart() {
        if (Utils.withFrequency("dex2oat_trace_freq", 75)) {
            // Dex2oat could take a while before it starts. Add a short delay before start tracing.
            Utils.traceSystem(sIProfcollect, "dex2oat", /* delayMs */ 1000);
            Utils.traceSystem(sIProfcollect, "dex2oat", /* durationMs */ 0, /* delayMs */ 1000);
        }
    }

+5 −4
Original line number Diff line number Diff line
@@ -44,13 +44,13 @@ final class Utils {
     * Request a system-wide trace.
     * Will be ignored if the device does not meet trace criteria or is being rate limited.
     */
    static boolean traceSystem(IProfCollectd iprofcollectd, String eventName) {
    static boolean traceSystem(IProfCollectd iprofcollectd, String eventName, int durationMs) {
        if (!checkPrerequisites(iprofcollectd)) {
            return false;
        }
        BackgroundThread.get().getThreadHandler().post(() -> {
            try {
                iprofcollectd.trace_system(eventName);
                iprofcollectd.trace_system(eventName, durationMs);
            } catch (RemoteException | ServiceSpecificException e) {
                Log.e(LOG_TAG, "Failed to initiate trace: " + e.getMessage());
            }
@@ -62,13 +62,14 @@ final class Utils {
     * Request a system-wide trace after a delay.
     * Will be ignored if the device does not meet trace criteria or is being rate limited.
     */
    static boolean traceSystem(IProfCollectd iprofcollectd, String eventName, int delayMs) {
    static boolean traceSystem(IProfCollectd iprofcollectd, String eventName, int durationMs,
            int delayMs) {
        if (!checkPrerequisites(iprofcollectd)) {
            return false;
        }
        BackgroundThread.get().getThreadHandler().postDelayed(() -> {
            try {
                iprofcollectd.trace_system(eventName);
                iprofcollectd.trace_system(eventName, durationMs);
            } catch (RemoteException | ServiceSpecificException e) {
                Log.e(LOG_TAG, "Failed to initiate trace: " + e.getMessage());
            }