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

Commit 0982ecbc authored by Zimuzo Ezeozue's avatar Zimuzo Ezeozue Committed by Android (Google) Code Review
Browse files

Merge "Switched MQ tracing to proto from DebugAnnotations" into main

parents 78095981 8551617b
Loading
Loading
Loading
Loading
+24 −0
Original line number Diff line number Diff line
@@ -139,6 +139,30 @@ public class TracePerfTest {
        }
    }

    @Test
    public void testInstantPerfettoWithProto() {
        PerfettoTrace.begin(FOO_CATEGORY, "message_queue_receive")
                .beginProto()
                .beginNested(2004 /* message_queue */)
                .addField(1 /* sending_thread_name */, "foo")
                .endNested()
                .endProto()
                .addTerminatingFlow(5)
                .emit();

        BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
        while (state.keepRunning()) {
            PerfettoTrace.begin(FOO_CATEGORY, "message_queue_receive")
                    .beginProto()
                    .beginNested(2004 /* message_queue */)
                    .addField(1 /* sending_thread_name */, "foo")
                    .endNested()
                    .endProto()
                    .addTerminatingFlow(5)
                    .emit();
        }
    }

    private static TraceConfig getTraceConfig(String cat) {
        BufferConfig bufferConfig = BufferConfig.newBuilder().setSizeKb(1024).build();
        TrackEventConfig trackEventConfig = TrackEventConfig
+7 −3
Original line number Diff line number Diff line
@@ -233,9 +233,13 @@ public final class MessageQueue {
        traceMessageCount();
        PerfettoTrace.instant(PerfettoTrace.MQ_CATEGORY, "message_queue_send")
                .addFlow(msg.mEventId.get())
                .addArg("receiving_thread", mThread.getName())
                .addArg("delay", when - SystemClock.uptimeMillis())
                .addArg("what", msg.what)
                .beginProto()
                .beginNested(2004 /* message_queue */)
                .addField(2 /* receiving_thread_name */, mThread.getName())
                .addField(3 /* message_code */, msg.what)
                .addField(4 /* message_delay_ms */, when - SystemClock.uptimeMillis())
                .endNested()
                .endProto()
                .emit();
    }

+5 −1
Original line number Diff line number Diff line
@@ -200,7 +200,11 @@ public final class Looper {
        }

        PerfettoTrace.begin(PerfettoTrace.MQ_CATEGORY, "message_queue_receive")
                .addArg("sending_thread", msg.mSendingThreadName)
                .beginProto()
                .beginNested(2004 /* message_queue */)
                .addField(1 /* sending_thread_name */, msg.mSendingThreadName)
                .endNested()
                .endProto()
                .addTerminatingFlow(msg.mEventId.get())
                .emit();