Loading apex/jobscheduler/service/java/com/android/server/job/JobStore.java +17 −1 Original line number Diff line number Diff line Loading @@ -133,7 +133,7 @@ public final class JobStore { @VisibleForTesting public static JobStore initAndGetForTesting(Context context, File dataDir) { JobStore jobStoreUnderTest = new JobStore(context, new Object(), dataDir); jobStoreUnderTest.clear(); jobStoreUnderTest.clearForTesting(); return jobStoreUnderTest; } Loading Loading @@ -222,6 +222,14 @@ public final class JobStore { return replaced; } /** * The same as above but does not schedule writing. This makes perf benchmarks more stable. */ @VisibleForTesting public void addForTesting(JobStatus jobStatus) { mJobSet.add(jobStatus); } boolean containsJob(JobStatus jobStatus) { return mJobSet.contains(jobStatus); } Loading Loading @@ -272,6 +280,14 @@ public final class JobStore { maybeWriteStatusToDiskAsync(); } /** * The same as above but does not schedule writing. This makes perf benchmarks more stable. */ @VisibleForTesting public void clearForTesting() { mJobSet.clear(); } /** * @param userHandle User for whom we are querying the list of jobs. * @return A list of all the jobs scheduled for the provided user. Never null. Loading tests/JobSchedulerPerfTests/src/com/android/frameworks/perftests/job/JobStorePerfTests.java +5 −6 Original line number Diff line number Diff line Loading @@ -82,11 +82,10 @@ public class JobStorePerfTests { long elapsedTimeNs = 0; while (benchmarkState.keepRunning(elapsedTimeNs)) { sJobStore.clear(); sJobStore.clearForTesting(); for (JobStatus job : jobList) { sJobStore.add(job); sJobStore.addForTesting(job); } sJobStore.waitForWriteToCompleteForTesting(10_000); final long startTime = SystemClock.elapsedRealtimeNanos(); sJobStore.writeStatusToDiskForTesting(); Loading @@ -110,11 +109,11 @@ public class JobStorePerfTests { long elapsedTimeNs = 0; while (benchmarkState.keepRunning(elapsedTimeNs)) { sJobStore.clear(); sJobStore.clearForTesting(); for (JobStatus job : jobList) { sJobStore.add(job); sJobStore.addForTesting(job); } sJobStore.waitForWriteToCompleteForTesting(10_000); sJobStore.writeStatusToDiskForTesting(); JobSet jobSet = new JobSet(); Loading Loading
apex/jobscheduler/service/java/com/android/server/job/JobStore.java +17 −1 Original line number Diff line number Diff line Loading @@ -133,7 +133,7 @@ public final class JobStore { @VisibleForTesting public static JobStore initAndGetForTesting(Context context, File dataDir) { JobStore jobStoreUnderTest = new JobStore(context, new Object(), dataDir); jobStoreUnderTest.clear(); jobStoreUnderTest.clearForTesting(); return jobStoreUnderTest; } Loading Loading @@ -222,6 +222,14 @@ public final class JobStore { return replaced; } /** * The same as above but does not schedule writing. This makes perf benchmarks more stable. */ @VisibleForTesting public void addForTesting(JobStatus jobStatus) { mJobSet.add(jobStatus); } boolean containsJob(JobStatus jobStatus) { return mJobSet.contains(jobStatus); } Loading Loading @@ -272,6 +280,14 @@ public final class JobStore { maybeWriteStatusToDiskAsync(); } /** * The same as above but does not schedule writing. This makes perf benchmarks more stable. */ @VisibleForTesting public void clearForTesting() { mJobSet.clear(); } /** * @param userHandle User for whom we are querying the list of jobs. * @return A list of all the jobs scheduled for the provided user. Never null. Loading
tests/JobSchedulerPerfTests/src/com/android/frameworks/perftests/job/JobStorePerfTests.java +5 −6 Original line number Diff line number Diff line Loading @@ -82,11 +82,10 @@ public class JobStorePerfTests { long elapsedTimeNs = 0; while (benchmarkState.keepRunning(elapsedTimeNs)) { sJobStore.clear(); sJobStore.clearForTesting(); for (JobStatus job : jobList) { sJobStore.add(job); sJobStore.addForTesting(job); } sJobStore.waitForWriteToCompleteForTesting(10_000); final long startTime = SystemClock.elapsedRealtimeNanos(); sJobStore.writeStatusToDiskForTesting(); Loading @@ -110,11 +109,11 @@ public class JobStorePerfTests { long elapsedTimeNs = 0; while (benchmarkState.keepRunning(elapsedTimeNs)) { sJobStore.clear(); sJobStore.clearForTesting(); for (JobStatus job : jobList) { sJobStore.add(job); sJobStore.addForTesting(job); } sJobStore.waitForWriteToCompleteForTesting(10_000); sJobStore.writeStatusToDiskForTesting(); JobSet jobSet = new JobSet(); Loading