Merge "Update debug printing." into tm-dev
This commit is contained in:
@@ -265,14 +265,6 @@ class JobConcurrencyManager {
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
|
||||||
* This array essentially stores the state of mActiveServices array.
|
|
||||||
* The ith index stores the job present on the ith JobServiceContext.
|
|
||||||
* We manipulate this array until we arrive at what jobs should be running on
|
|
||||||
* what JobServiceContext.
|
|
||||||
*/
|
|
||||||
JobStatus[] mRecycledAssignContextIdToJobMap = new JobStatus[MAX_JOB_CONTEXTS_COUNT];
|
|
||||||
|
|
||||||
private final ArraySet<ContextAssignment> mRecycledChanged = new ArraySet<>();
|
private final ArraySet<ContextAssignment> mRecycledChanged = new ArraySet<>();
|
||||||
private final ArraySet<ContextAssignment> mRecycledIdle = new ArraySet<>();
|
private final ArraySet<ContextAssignment> mRecycledIdle = new ArraySet<>();
|
||||||
private final ArraySet<ContextAssignment> mRecycledPreferredUidOnly = new ArraySet<>();
|
private final ArraySet<ContextAssignment> mRecycledPreferredUidOnly = new ArraySet<>();
|
||||||
@@ -580,7 +572,6 @@ class JobConcurrencyManager {
|
|||||||
final List<JobServiceContext> activeServices = mActiveServices;
|
final List<JobServiceContext> activeServices = mActiveServices;
|
||||||
|
|
||||||
// To avoid GC churn, we recycle the arrays.
|
// To avoid GC churn, we recycle the arrays.
|
||||||
JobStatus[] contextIdToJobMap = mRecycledAssignContextIdToJobMap;
|
|
||||||
final ArraySet<ContextAssignment> changed = mRecycledChanged;
|
final ArraySet<ContextAssignment> changed = mRecycledChanged;
|
||||||
final ArraySet<ContextAssignment> idle = mRecycledIdle;
|
final ArraySet<ContextAssignment> idle = mRecycledIdle;
|
||||||
final ArraySet<ContextAssignment> preferredUidOnly = mRecycledPreferredUidOnly;
|
final ArraySet<ContextAssignment> preferredUidOnly = mRecycledPreferredUidOnly;
|
||||||
@@ -638,7 +629,7 @@ class JobConcurrencyManager {
|
|||||||
idle.add(assignment);
|
idle.add(assignment);
|
||||||
}
|
}
|
||||||
if (DEBUG) {
|
if (DEBUG) {
|
||||||
Slog.d(TAG, printContextIdToJobMap(contextIdToJobMap, "running jobs initial"));
|
Slog.d(TAG, printAssignments("running jobs initial", stoppable, preferredUidOnly));
|
||||||
}
|
}
|
||||||
|
|
||||||
mWorkCountTracker.onCountDone();
|
mWorkCountTracker.onCountDone();
|
||||||
@@ -747,7 +738,8 @@ class JobConcurrencyManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (DEBUG) {
|
if (DEBUG) {
|
||||||
Slog.d(TAG, printContextIdToJobMap(contextIdToJobMap, "running jobs final"));
|
Slog.d(TAG, printAssignments("running jobs final",
|
||||||
|
stoppable, preferredUidOnly, changed));
|
||||||
|
|
||||||
Slog.d(TAG, "assignJobsToContexts: " + mWorkCountTracker.toString());
|
Slog.d(TAG, "assignJobsToContexts: " + mWorkCountTracker.toString());
|
||||||
}
|
}
|
||||||
@@ -1283,13 +1275,26 @@ class JobConcurrencyManager {
|
|||||||
return s.toString();
|
return s.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static String printContextIdToJobMap(JobStatus[] map, String initial) {
|
private static String printAssignments(String header, ArraySet<ContextAssignment>... list) {
|
||||||
StringBuilder s = new StringBuilder(initial + ": ");
|
final StringBuilder s = new StringBuilder(header + ": ");
|
||||||
for (int i=0; i<map.length; i++) {
|
for (int l = 0; l < list.length; ++l) {
|
||||||
s.append("(")
|
ArraySet<ContextAssignment> assignments = list[l];
|
||||||
.append(map[i] == null? -1: map[i].getJobId())
|
for (int c = 0; c < assignments.size(); ++c) {
|
||||||
.append(map[i] == null? -1: map[i].getUid())
|
final ContextAssignment assignment = assignments.valueAt(c);
|
||||||
.append(")" );
|
final JobStatus job = assignment.newJob == null
|
||||||
|
? assignment.context.getRunningJobLocked() : assignment.newJob;
|
||||||
|
|
||||||
|
if (l > 0 || c > 0) {
|
||||||
|
s.append(" ");
|
||||||
|
}
|
||||||
|
s.append("(").append(assignment.context.getId()).append("=");
|
||||||
|
if (job == null) {
|
||||||
|
s.append("nothing");
|
||||||
|
} else {
|
||||||
|
s.append(job.getJobId()).append("/").append(job.getUid());
|
||||||
|
}
|
||||||
|
s.append(")");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return s.toString();
|
return s.toString();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user