[Telemetry] Include (compos) job cancellation reason
Job scheduler sometimes cancels the compos job, in which case, getStopReason() will give the reason, by default it returns STOP_REASON_UNDEFINED. Test: build suceeded Bug: 234151510 Change-Id: I10f29db6f45d8e9423b498d45769f39755c791fb
This commit is contained in:
parent
7a13b3fc9a
commit
852629dccb
|
@ -204,7 +204,7 @@ public class IsolatedCompilationJobService extends JobService {
|
|||
Log.w(TAG, "Failed to cancel CompilationTask", e);
|
||||
}
|
||||
|
||||
mMetrics.onCompilationEnded(IsolatedCompilationMetrics.RESULT_JOB_CANCELED);
|
||||
mMetrics.onCompilationJobCanceled(mParams.getStopReason());
|
||||
try {
|
||||
task.asBinder().unlinkToDeath(this, 0);
|
||||
} catch (NoSuchElementException e) {
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
package com.android.server.compos;
|
||||
|
||||
import android.annotation.IntDef;
|
||||
import android.app.job.JobParameters;
|
||||
import android.os.SystemClock;
|
||||
import android.util.Log;
|
||||
|
||||
|
@ -76,7 +77,6 @@ class IsolatedCompilationMetrics {
|
|||
private long mCompilationStartTimeMs = 0;
|
||||
|
||||
public static void onCompilationScheduled(@ScheduleJobResult int result) {
|
||||
// TODO(b/218525257): write to ArtStatsLog instead of logcat
|
||||
ArtStatsLog.write(ArtStatsLog.ISOLATED_COMPILATION_SCHEDULED, result);
|
||||
Log.i(TAG, "ISOLATED_COMPILATION_SCHEDULED: " + result);
|
||||
}
|
||||
|
@ -85,13 +85,24 @@ class IsolatedCompilationMetrics {
|
|||
mCompilationStartTimeMs = SystemClock.elapsedRealtime();
|
||||
}
|
||||
|
||||
public void onCompilationJobCanceled(@JobParameters.StopReason int jobStopReason) {
|
||||
statsLogPostCompilation(RESULT_JOB_CANCELED, jobStopReason);
|
||||
}
|
||||
|
||||
public void onCompilationEnded(@CompilationResult int result) {
|
||||
statsLogPostCompilation(result, JobParameters.STOP_REASON_UNDEFINED);
|
||||
}
|
||||
|
||||
private void statsLogPostCompilation(@CompilationResult int result,
|
||||
@JobParameters.StopReason int jobStopReason) {
|
||||
|
||||
long compilationTime = mCompilationStartTimeMs == 0 ? -1
|
||||
: SystemClock.elapsedRealtime() - mCompilationStartTimeMs;
|
||||
mCompilationStartTimeMs = 0;
|
||||
|
||||
// TODO(b/218525257): write to ArtStatsLog instead of logcat
|
||||
ArtStatsLog.write(ArtStatsLog.ISOLATED_COMPILATION_ENDED, compilationTime, result);
|
||||
Log.i(TAG, "ISOLATED_COMPILATION_ENDED: " + result + ", " + compilationTime);
|
||||
ArtStatsLog.write(ArtStatsLog.ISOLATED_COMPILATION_ENDED, compilationTime,
|
||||
result, jobStopReason);
|
||||
Log.i(TAG, "ISOLATED_COMPILATION_ENDED: " + result + ", " + compilationTime
|
||||
+ ", " + jobStopReason);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue