Trace job execution.
Also include the job ID in the battery name so that we can distinguish between jobs using the same JobService. Bug: 230864839 Test: N/A Change-Id: Ia183329ef398b8a8fe9ef246a0f0592cd274a88f (cherry pick of ag/18972117 and ag/19969125)
This commit is contained in:
committed by
Simon MacMullen
parent
56cf35b281
commit
6c0d3e107f
@@ -43,6 +43,7 @@ import android.os.Looper;
|
||||
import android.os.Message;
|
||||
import android.os.PowerManager;
|
||||
import android.os.RemoteException;
|
||||
import android.os.Trace;
|
||||
import android.os.UserHandle;
|
||||
import android.util.EventLog;
|
||||
import android.util.IndentingPrintWriter;
|
||||
@@ -361,6 +362,9 @@ public final class JobServiceContext implements ServiceConnection {
|
||||
job.getJob().getPriority(),
|
||||
job.getEffectivePriority(),
|
||||
job.getNumFailures());
|
||||
// Use the context's ID to distinguish traces since there'll only be one job running
|
||||
// per context.
|
||||
Trace.asyncTraceBegin(Trace.TRACE_TAG_SYSTEM_SERVER, job.getTag(), getId());
|
||||
try {
|
||||
mBatteryStats.noteJobStart(job.getBatteryName(), job.getSourceUid());
|
||||
} catch (RemoteException e) {
|
||||
@@ -1024,6 +1028,7 @@ public final class JobServiceContext implements ServiceConnection {
|
||||
completedJob.getJob().getPriority(),
|
||||
completedJob.getEffectivePriority(),
|
||||
completedJob.getNumFailures());
|
||||
Trace.asyncTraceEnd(Trace.TRACE_TAG_SYSTEM_SERVER, completedJob.getTag(), getId());
|
||||
try {
|
||||
mBatteryStats.noteJobFinish(mRunningJob.getBatteryName(), mRunningJob.getSourceUid(),
|
||||
internalStopReason);
|
||||
|
||||
@@ -496,7 +496,7 @@ public final class JobStatus {
|
||||
this.batteryName = this.sourceTag != null
|
||||
? this.sourceTag + ":" + job.getService().getPackageName()
|
||||
: job.getService().flattenToShortString();
|
||||
this.tag = "*job*/" + this.batteryName;
|
||||
this.tag = "*job*/" + this.batteryName + "#" + job.getId();
|
||||
|
||||
this.earliestRunTimeElapsedMillis = earliestRunTimeElapsedMillis;
|
||||
this.latestRunTimeElapsedMillis = latestRunTimeElapsedMillis;
|
||||
|
||||
Reference in New Issue
Block a user