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

Commit 9fb3fd1d authored by Jeff Brown's avatar Jeff Brown
Browse files

To help assess latency, dump the time a broadcast was enqueued.

Previously we only dumped the time when a broadcast started dispatch.
Start tracking the time when a broadcast was enqueued so that
we can determine whether the broadcast queue was stalled and for
how long.  Together with other information in the dump, this can help
to ascertain whether broadcast latency is being caused by the sender,
the dispatcher, or the receiver.

Bug: 17695520
Change-Id: I4f2e4bb92f9178f5d095b9124a15eb2e5f13b9f6
parent 5d8a69f2
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -187,10 +187,12 @@ public final class BroadcastQueue {

    public void enqueueParallelBroadcastLocked(BroadcastRecord r) {
        mParallelBroadcasts.add(r);
        r.enqueueClockTime = System.currentTimeMillis();
    }

    public void enqueueOrderedBroadcastLocked(BroadcastRecord r) {
        mOrderedBroadcasts.add(r);
        r.enqueueClockTime = System.currentTimeMillis();
    }

    public final boolean replaceParallelBroadcastLocked(BroadcastRecord r) {
+4 −1
Original line number Diff line number Diff line
@@ -52,6 +52,7 @@ final class BroadcastRecord extends Binder {
    final int appOp;        // an app op that is associated with this broadcast
    final List receivers;   // contains BroadcastFilter and ResolveInfo
    IIntentReceiver resultTo; // who receives final result if non-null
    long enqueueClockTime;  // the clock time the broadcast was enqueued
    long dispatchTime;      // when dispatch started on this set of receivers
    long dispatchClockTime; // the clock time the dispatch started
    long receiverTime;      // when current receiver started for timeouts.
@@ -102,7 +103,9 @@ final class BroadcastRecord extends Binder {
            pw.print(prefix); pw.print("requiredPermission="); pw.print(requiredPermission);
                    pw.print("  appOp="); pw.println(appOp);
        }
        pw.print(prefix); pw.print("dispatchClockTime=");
        pw.print(prefix); pw.print("enqueueClockTime=");
                pw.print(new Date(enqueueClockTime));
                pw.print(" dispatchClockTime=");
                pw.println(new Date(dispatchClockTime));
        pw.print(prefix); pw.print("dispatchTime=");
                TimeUtils.formatDuration(dispatchTime, now, pw);