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

Commit 9f337098 authored by Kean Mariotti's avatar Kean Mariotti
Browse files

system server: configure 4 MB perfetto shmem buffer

Increase Perfetto's shmem buffer from default size (256 KB) to 4 MB
to avoid crashes (too long perfetto producer stalls) caused by shmem
chunks exhaustion/contention.

Bug: b/382369925
Flag: android.tracing.system_server_large_perfetto_shmem_buffer
Test: presubmit
Change-Id: I5b6ab40cb3987a7aed7bb09801f02bea3f3962a2
parent 57724986
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -70,3 +70,11 @@ flag {
    is_fixed_read_only: true
    bug: "352538294"
}

flag {
    name: "system_server_large_perfetto_shmem_buffer"
    namespace: "windowing_tools"
    description: "Large perfetto shmem buffer"
    is_fixed_read_only: true
    bug: "382369925"
}
+7 −0
Original line number Diff line number Diff line
@@ -91,6 +91,7 @@ import android.server.ServerProtoEnums;
import android.system.ErrnoException;
import android.system.Os;
import android.text.TextUtils;
import android.tracing.perfetto.InitArguments;
import android.util.ArrayMap;
import android.util.DisplayMetrics;
import android.util.Dumpable;
@@ -791,6 +792,12 @@ public final class SystemServer implements Dumpable {
    private void run() {
        TimingsTraceAndSlog t = new TimingsTraceAndSlog();
        try {
            if (android.tracing.Flags.systemServerLargePerfettoShmemBuffer()) {
                // Explicitly initialize a 4 MB shmem buffer for Perfetto producers (b/382369925)
                android.tracing.perfetto.Producer.init(new InitArguments(
                        InitArguments.PERFETTO_BACKEND_SYSTEM, 4 * 1024));
            }

            t.traceBegin("InitBeforeStartServices");

            // Record the process start information in sys props.