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

Commit 2fab83a9 authored by Shai Barack's avatar Shai Barack Committed by Android (Google) Code Review
Browse files

Merge "Message tracing: use plain long, not AtomicLong" into main

parents ec205077 436a8a9f
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -254,12 +254,12 @@ public final class MessageQueue {
        mMessageCount.incrementAndGet();
        if (PerfettoTrace.MQ_CATEGORY.isEnabled()) {
            msg.sendingThreadName = Thread.currentThread().getName();
            msg.mEventId.set(PerfettoTrace.getFlowId());
            final long eventId = msg.eventId = PerfettoTrace.getFlowId();

            traceMessageCount();
            final long messageDelayMs = Math.max(0L, when - SystemClock.uptimeMillis());
            PerfettoTrace.instant(PerfettoTrace.MQ_CATEGORY, "message_queue_send")
                    .setFlow(msg.mEventId.get())
                    .setFlow(eventId)
                    .beginProto()
                    .beginNested(2004 /* message_queue */)
                    .addField(2 /* receiving_thread_name */, mThreadName)
@@ -2890,6 +2890,7 @@ public final class MessageQueue {
        msg.when = when;
        msg.insertSeq = seq;
        msg.markInUse();
        incAndTraceMessageCount(msg, when);

        if (DEBUG) {
            Log.d(TAG_C, "Insert message"
@@ -2910,7 +2911,6 @@ public final class MessageQueue {
            }

            insertIntoPriorityQueue(msg);
            incAndTraceMessageCount(msg, when);
            /*
             * We still need to do this even though we are the current thread,
             * otherwise next() may sleep indefinitely.
@@ -2957,6 +2957,7 @@ public final class MessageQueue {

                case STACK_NODE_QUITTING:
                    logDeadThread(msg);
                    decAndTraceMessageCount();
                    return false;

                default:
+1 −1
Original line number Diff line number Diff line
@@ -207,7 +207,7 @@ public final class Looper {
                    .addField(1 /* sending_thread_name */, msg.sendingThreadName)
                    .endNested()
                    .endProto()
                    .setTerminatingFlow(msg.mEventId.get())
                    .setTerminatingFlow(msg.eventId)
                    .emit();
        }

+4 −6
Original line number Diff line number Diff line
@@ -39,12 +39,6 @@ import java.util.concurrent.atomic.AtomicLong;
 */
@android.ravenwood.annotation.RavenwoodKeepWholeClass
public final class Message implements Parcelable {
    /**
     * For tracing
     *
     * @hide Only for use within the system server.
     */
    public final AtomicLong mEventId = new AtomicLong();

    /**
     * User-defined message code so that the recipient can identify
@@ -162,6 +156,10 @@ public final class Message implements Parcelable {
    @UnsupportedAppUsage
    /*package*/ Message next;

    /**
     * For trace flows, if tracing is enabled.
     */
    /*package*/ volatile long eventId;

    /** @hide */
    public static final Object sPoolSync = new Object();