Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
platform_frameworks_base-old
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Farzin Kazemzadeh
platform_frameworks_base-old
Commits
051c3ff0
Commit
051c3ff0
authored
4 years ago
by
Kweku Adams
Committed by
Android (Google) Code Review
4 years ago
Browse files
Options
Downloads
Plain Diff
Merge "Dump most recently completed jobs." into sc-dev
parents
4fe89b22
85ffb924
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
apex/jobscheduler/service/java/com/android/server/job/JobSchedulerService.java
+41
-0
41 additions, 0 deletions
...vice/java/com/android/server/job/JobSchedulerService.java
with
41 additions
and
0 deletions
apex/jobscheduler/service/java/com/android/server/job/JobSchedulerService.java
+
41
−
0
View file @
051c3ff0
...
...
@@ -151,6 +151,8 @@ public class JobSchedulerService extends com.android.server.SystemService
private
static
final
boolean
ENFORCE_MAX_JOBS
=
true
;
/** The maximum number of jobs that we allow an unprivileged app to schedule */
private
static
final
int
MAX_JOBS_PER_APP
=
100
;
/** The number of the most recently completed jobs to keep track of for debugging purposes. */
private
static
final
int
NUM_COMPLETED_JOB_HISTORY
=
20
;
@VisibleForTesting
public
static
Clock
sSystemClock
=
Clock
.
systemUTC
();
...
...
@@ -297,6 +299,10 @@ public class JobSchedulerService extends com.android.server.SystemService
*/
boolean
mReportedActive
;
private
int
mLastCompletedJobIndex
=
0
;
private
final
JobStatus
[]
mLastCompletedJobs
=
new
JobStatus
[
NUM_COMPLETED_JOB_HISTORY
];
private
final
long
[]
mLastCompletedJobTimeElapsed
=
new
long
[
NUM_COMPLETED_JOB_HISTORY
];
/**
* A mapping of which uids are currently in the foreground to their effective priority.
*/
...
...
@@ -1752,6 +1758,10 @@ public class JobSchedulerService extends com.android.server.SystemService
Slog
.
d
(
TAG
,
"Completed "
+
jobStatus
+
", reschedule="
+
needsReschedule
);
}
mLastCompletedJobs
[
mLastCompletedJobIndex
]
=
jobStatus
;
mLastCompletedJobTimeElapsed
[
mLastCompletedJobIndex
]
=
sElapsedRealtimeClock
.
millis
();
mLastCompletedJobIndex
=
(
mLastCompletedJobIndex
+
1
)
%
NUM_COMPLETED_JOB_HISTORY
;
// Intentionally not checking expedited job quota here. An app can't find out if it's run
// out of quota when it asks JS to reschedule an expedited job. Instead, the rescheduled
// EJ will just be demoted to a regular job if the app has no EJ quota left.
...
...
@@ -3298,6 +3308,37 @@ public class JobSchedulerService extends com.android.server.SystemService
}
}
pw
.
decreaseIndent
();
pw
.
println
();
boolean
recentPrinted
=
false
;
pw
.
println
(
"Recently completed jobs:"
);
pw
.
increaseIndent
();
for
(
int
r
=
1
;
r
<=
NUM_COMPLETED_JOB_HISTORY
;
++
r
)
{
// Print most recent first
final
int
idx
=
(
mLastCompletedJobIndex
+
NUM_COMPLETED_JOB_HISTORY
-
r
)
%
NUM_COMPLETED_JOB_HISTORY
;
final
JobStatus
job
=
mLastCompletedJobs
[
idx
];
if
(
job
!=
null
)
{
if
(!
predicate
.
test
(
job
))
{
continue
;
}
recentPrinted
=
true
;
TimeUtils
.
formatDuration
(
mLastCompletedJobTimeElapsed
[
idx
],
nowElapsed
,
pw
);
pw
.
println
();
// Double indent for readability
pw
.
increaseIndent
();
pw
.
increaseIndent
();
job
.
dump
(
pw
,
true
,
nowElapsed
);
pw
.
decreaseIndent
();
pw
.
decreaseIndent
();
}
}
if
(!
recentPrinted
)
{
pw
.
println
(
"None"
);
}
pw
.
decreaseIndent
();
pw
.
println
();
if
(
filterUid
==
-
1
)
{
pw
.
println
();
pw
.
print
(
"mReadyToRock="
);
pw
.
println
(
mReadyToRock
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment