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

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

Merge "Remove addFlow/TerminatingFlow" into main

parents f7b282c1 0d4dced8
Loading
Loading
Loading
Loading
+2 −2
Original line number Original line Diff line number Diff line
@@ -147,7 +147,7 @@ public class TracePerfTest {
                .addField(1 /* sending_thread_name */, "foo")
                .addField(1 /* sending_thread_name */, "foo")
                .endNested()
                .endNested()
                .endProto()
                .endProto()
                .addTerminatingFlow(5)
                .setTerminatingFlow(5)
                .emit();
                .emit();


        BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
        BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
@@ -158,7 +158,7 @@ public class TracePerfTest {
                    .addField(1 /* sending_thread_name */, "foo")
                    .addField(1 /* sending_thread_name */, "foo")
                    .endNested()
                    .endNested()
                    .endProto()
                    .endProto()
                    .addTerminatingFlow(5)
                    .setTerminatingFlow(5)
                    .emit();
                    .emit();
        }
        }
    }
    }
+1 −1
Original line number Original line Diff line number Diff line
@@ -223,7 +223,7 @@ public final class MessageQueue {


        traceMessageCount();
        traceMessageCount();
        PerfettoTrace.instant(PerfettoTrace.MQ_CATEGORY, "message_queue_send")
        PerfettoTrace.instant(PerfettoTrace.MQ_CATEGORY, "message_queue_send")
                .addFlow(msg.mEventId.get())
                .setFlow(msg.mEventId.get())
                .beginProto()
                .beginProto()
                .beginNested(2004 /* message_queue */)
                .beginNested(2004 /* message_queue */)
                .addField(2 /* receiving_thread_name */, mThread.getName())
                .addField(2 /* receiving_thread_name */, mThread.getName())
+1 −1
Original line number Original line Diff line number Diff line
@@ -205,7 +205,7 @@ public final class Looper {
                .addField(1 /* sending_thread_name */, msg.mSendingThreadName)
                .addField(1 /* sending_thread_name */, msg.mSendingThreadName)
                .endNested()
                .endNested()
                .endProto()
                .endProto()
                .addTerminatingFlow(msg.mEventId.get())
                .setTerminatingFlow(msg.mEventId.get())
                .emit();
                .emit();


        // This must be in a local variabe, in case a UI event sets the logger
        // This must be in a local variabe, in case a UI event sets the logger
+2 −2
Original line number Original line Diff line number Diff line
@@ -23,7 +23,7 @@ import android.util.proto.ProtoOutputStream;


import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.annotations.VisibleForTesting;


import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicLong;


/**
/**
 *
 *
@@ -43,7 +43,7 @@ public final class Message implements Parcelable {
     *
     *
     * @hide Only for use within the system server.
     * @hide Only for use within the system server.
     */
     */
    public final AtomicInteger mEventId = new AtomicInteger();
    public final AtomicLong mEventId = new AtomicLong();


    /**
    /**
     * User-defined message code so that the recipient can identify
     * User-defined message code so that the recipient can identify
+2 −38
Original line number Original line Diff line number Diff line
@@ -172,7 +172,6 @@ public final class PerfettoTrackEventExtra {
        private final Pool<FieldDouble> mFieldDoubleCache;
        private final Pool<FieldDouble> mFieldDoubleCache;
        private final Pool<FieldString> mFieldStringCache;
        private final Pool<FieldString> mFieldStringCache;
        private final Pool<FieldNested> mFieldNestedCache;
        private final Pool<FieldNested> mFieldNestedCache;
        private final Pool<Flow> mFlowCache;
        private final Pool<Builder> mBuilderCache;
        private final Pool<Builder> mBuilderCache;


        private Builder() {
        private Builder() {
@@ -187,7 +186,6 @@ public final class PerfettoTrackEventExtra {
            mFieldDoubleCache = mExtra.mFieldDoubleCache;
            mFieldDoubleCache = mExtra.mFieldDoubleCache;
            mFieldStringCache = mExtra.mFieldStringCache;
            mFieldStringCache = mExtra.mFieldStringCache;
            mFieldNestedCache = mExtra.mFieldNestedCache;
            mFieldNestedCache = mExtra.mFieldNestedCache;
            mFlowCache = mExtra.mFlowCache;
            mBuilderCache = mExtra.mBuilderCache;
            mBuilderCache = mExtra.mBuilderCache;


            mCounterInt64 = mExtra.getCounterInt64();
            mCounterInt64 = mExtra.getCounterInt64();
@@ -227,7 +225,6 @@ public final class PerfettoTrackEventExtra {
            mFieldStringCache.reset();
            mFieldStringCache.reset();
            mFieldNestedCache.reset();
            mFieldNestedCache.reset();
            mBuilderCache.reset();
            mBuilderCache.reset();
            mFlowCache.reset();


            mExtra.reset();
            mExtra.reset();
            // Reset after on init in case the thread created builders without calling emit
            // Reset after on init in case the thread created builders without calling emit
@@ -325,39 +322,7 @@ public final class PerfettoTrackEventExtra {
        /**
        /**
         * Adds a flow with {@code id}.
         * Adds a flow with {@code id}.
         */
         */
        public Builder addFlow(int id) {
        public Builder setFlow(long id) {
            if (!mIsCategoryEnabled) {
                return this;
            }
            if (DEBUG) {
                checkParent();
            }
            Flow flow = mFlowCache.get(sFlowSupplier);
            flow.setProcessFlow(id);
            mExtra.addPerfettoPointer(flow);
            return this;
        }

        /**
         * Adds a terminating flow with {@code id}.
         */
        public Builder addTerminatingFlow(int id) {
            if (!mIsCategoryEnabled) {
                return this;
            }
            if (DEBUG) {
                checkParent();
            }
            Flow flow = mFlowCache.get(sFlowSupplier);
            flow.setProcessTerminatingFlow(id);
            mExtra.addPerfettoPointer(flow);
            return this;
        }

        /**
         * Adds a flow with {@code id}.
         */
        public Builder setFlow(int id) {
            if (!mIsCategoryEnabled) {
            if (!mIsCategoryEnabled) {
                return this;
                return this;
            }
            }
@@ -372,7 +337,7 @@ public final class PerfettoTrackEventExtra {
        /**
        /**
         * Adds a terminating flow with {@code id}.
         * Adds a terminating flow with {@code id}.
         */
         */
        public Builder setTerminatingFlow(int id) {
        public Builder setTerminatingFlow(long id) {
            if (!mIsCategoryEnabled) {
            if (!mIsCategoryEnabled) {
                return this;
                return this;
            }
            }
@@ -670,7 +635,6 @@ public final class PerfettoTrackEventExtra {
    private final Pool<FieldDouble> mFieldDoubleCache = new Pool(DEFAULT_EXTRA_CACHE_SIZE);
    private final Pool<FieldDouble> mFieldDoubleCache = new Pool(DEFAULT_EXTRA_CACHE_SIZE);
    private final Pool<FieldString> mFieldStringCache = new Pool(DEFAULT_EXTRA_CACHE_SIZE);
    private final Pool<FieldString> mFieldStringCache = new Pool(DEFAULT_EXTRA_CACHE_SIZE);
    private final Pool<FieldNested> mFieldNestedCache = new Pool(DEFAULT_EXTRA_CACHE_SIZE);
    private final Pool<FieldNested> mFieldNestedCache = new Pool(DEFAULT_EXTRA_CACHE_SIZE);
    private final Pool<Flow> mFlowCache = new Pool(DEFAULT_EXTRA_CACHE_SIZE);
    private final Pool<Builder> mBuilderCache = new Pool(DEFAULT_EXTRA_CACHE_SIZE);
    private final Pool<Builder> mBuilderCache = new Pool(DEFAULT_EXTRA_CACHE_SIZE);


    private static final NativeAllocationRegistry sRegistry =
    private static final NativeAllocationRegistry sRegistry =