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

Commit 0704a9e5 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Track pending job latency" into oc-dev

parents 044eeecc 7234fc6f
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -345,6 +345,7 @@ public final class JobPackageTracker {

    public void notePending(JobStatus job) {
        final long now = SystemClock.uptimeMillis();
        job.madePending = now;
        rebatchIfNeeded(now);
        mCurDataSet.incPending(job.getSourceUid(), job.getSourcePackageName(), now);
    }
@@ -357,6 +358,7 @@ public final class JobPackageTracker {

    public void noteActive(JobStatus job) {
        final long now = SystemClock.uptimeMillis();
        job.madeActive = now;
        rebatchIfNeeded(now);
        if (job.lastEvaluatedPriority >= JobInfo.PRIORITY_TOP_APP) {
            mCurDataSet.incActiveTop(job.getSourceUid(), job.getSourcePackageName(), now);
+11 −3
Original line number Diff line number Diff line
@@ -2035,27 +2035,35 @@ public final class JobSchedulerService extends com.android.server.SystemService
                    pw.print("    Evaluated priority: "); pw.println(priority);
                }
                pw.print("    Tag: "); pw.println(job.getTag());
                pw.print("    Enq: ");
                TimeUtils.formatDuration(now - job.madePending, pw);
                pw.println(" ago");
            }
            pw.println();
            pw.println("Active jobs:");
            for (int i=0; i<mActiveServices.size(); i++) {
                JobServiceContext jsc = mActiveServices.get(i);
                pw.print("  Slot #"); pw.print(i); pw.print(": ");
                if (jsc.getRunningJob() == null) {
                final JobStatus job = jsc.getRunningJob();
                if (job == null) {
                    pw.println("inactive");
                    continue;
                } else {
                    pw.println(jsc.getRunningJob().toShortString());
                    pw.println(job.toShortString());
                    pw.print("    Running for: ");
                    TimeUtils.formatDuration(now - jsc.getExecutionStartTimeElapsed(), pw);
                    pw.print(", timeout at: ");
                    TimeUtils.formatDuration(jsc.getTimeoutElapsed() - now, pw);
                    pw.println();
                    jsc.getRunningJob().dump(pw, "    ", false);
                    job.dump(pw, "    ", false);
                    int priority = evaluateJobPriorityLocked(jsc.getRunningJob());
                    if (priority != JobInfo.PRIORITY_DEFAULT) {
                        pw.print("    Evaluated priority: "); pw.println(priority);
                    }
                    pw.print("    Active at "); pw.println(job.madeActive);
                    pw.print("    Pending for ");
                    TimeUtils.formatDuration(job.madeActive - job.madePending, pw);
                    pw.println();
                }
            }
            if (filterUid == -1) {
+6 −2
Original line number Diff line number Diff line
@@ -147,7 +147,6 @@ public class IdleController extends StateController {
        @Override
        public void onReceive(Context context, Intent intent) {
            final String action = intent.getAction();

            if (action.equals(Intent.ACTION_SCREEN_ON)
                    || action.equals(Intent.ACTION_DREAMING_STOPPED)) {
                if (DEBUG) {
@@ -183,6 +182,11 @@ public class IdleController extends StateController {
                    }
                    mIdle = true;
                    reportNewIdleState(mIdle);
                } else {
                    if (DEBUG) {
                        Slog.v(TAG, "TRIGGER_IDLE received but not changing state; idle="
                                + mIdle + " screen=" + mScreenOn);
                    }
                }
            }
        }
@@ -191,7 +195,7 @@ public class IdleController extends StateController {
    @Override
    public void dumpControllerStateLocked(PrintWriter pw, int filterUid) {
        pw.print("Idle: ");
        pw.println(mIdleTracker.isIdle() ? "true" : "false");
        pw.println(mIdleTracker.isIdle());
        pw.print("Tracking ");
        pw.print(mTrackedTasks.size());
        pw.println(":");
+4 −0
Original line number Diff line number Diff line
@@ -129,6 +129,10 @@ public final class JobStatus {
    // Used by shell commands
    public int overrideState = 0;

    // Metrics about queue latency
    public long madePending;
    public long madeActive;

    /**
     * For use only by ContentObserverController: state it is maintaining about content URIs
     * being observed.