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

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

Merge "Wrapped mq tracing in explicit tracing enabled checks" into main

parents 51c44b7e 555c7b32
Loading
Loading
Loading
Loading
+19 −15
Original line number Diff line number Diff line
@@ -236,11 +236,14 @@ public final class MessageQueue {

    private void decAndTraceMessageCount() {
        mMessageCount.decrementAndGet();
        if (PerfettoTrace.MQ_CATEGORY.isEnabled()) {
            traceMessageCount();
        }
    }

    private void incAndTraceMessageCount(Message msg, long when) {
        mMessageCount.incrementAndGet();
        if (PerfettoTrace.MQ_CATEGORY.isEnabled()) {
            msg.mSendingThreadName = Thread.currentThread().getName();
            msg.mEventId.set(PerfettoTrace.getFlowId());

@@ -256,6 +259,7 @@ public final class MessageQueue {
                    .endProto()
                    .emit();
        }
    }

    /** @hide */
    private void traceMessageCount() {
+13 −9
Original line number Diff line number Diff line
@@ -199,6 +199,7 @@ public final class Looper {
            return false;
        }

        if (PerfettoTrace.MQ_CATEGORY.isEnabled()) {
            PerfettoTrace.begin(PerfettoTrace.MQ_CATEGORY, "message_queue_receive")
                    .beginProto()
                    .beginNested(2004 /* message_queue */)
@@ -207,6 +208,7 @@ public final class Looper {
                    .endProto()
                    .setTerminatingFlow(msg.mEventId.get())
                    .emit();
        }

        // This must be in a local variabe, in case a UI event sets the logger
        final Printer logging = me.mLogging;
@@ -297,8 +299,10 @@ public final class Looper {
                    + msg.target.getClass().getName() + " "
                    + msg.callback + " what=" + msg.what);
        }

        if (PerfettoTrace.MQ_CATEGORY.isEnabled()) {
            PerfettoTrace.end(PerfettoTrace.MQ_CATEGORY).emit();
        }

        msg.recycleUnchecked();

        return true;