Make it possible to persist jobs in a separate file for each calling
UID. This makes it easier to persist changes to jobs of individual apps
instead of having to write the entire set of jobs every time something
changes.
Read times decrease by 2-5% when there are many jobs for each app but
increase by 33-35% when there are only a few jobs per app.
Write times increase by 5% (for many jobs) to 64% (for few jobs) for a
full write but decrease by 1% (for few jobs) to 38% (for many jobs) when
there are partial writes.
JobScheduler is read-once, write-many system, and apart from migration
from between monolithic and split file architectures, should mostly be
in the partial write scenario.
The code is disabled for now and will be turned on separately.
Performance Test Results:
(With monolithic file):
com.android.frameworks.perftests.job.JobStorePerfTests#testPersistedJobReading_fewJobs_badRTC
testPersistedJobReading_fewJobs_badRTC_mean (ns): 4632075
testPersistedJobReading_fewJobs_badRTC_median (ns): 4568177
com.android.frameworks.perftests.job.JobStorePerfTests#testPersistedJobWriting_manyJobs
testPersistedJobWriting_manyJobs_mean (ns): 38133928
testPersistedJobWriting_manyJobs_median (ns): 37794691
com.android.frameworks.perftests.job.JobStorePerfTests#testPersistedJobReading_manyJobs_goodRTC
testPersistedJobReading_manyJobs_goodRTC_mean (ns): 46015412
testPersistedJobReading_manyJobs_goodRTC_median (ns): 45553494
com.android.frameworks.perftests.job.JobStorePerfTests#testPersistedJobWriting_fewJobs
testPersistedJobWriting_fewJobs_mean (ns): 4903462
testPersistedJobWriting_fewJobs_median (ns): 4914740
com.android.frameworks.perftests.job.JobStorePerfTests#testPersistedJobReading_fewJobs_goodRTC
testPersistedJobReading_fewJobs_goodRTC_mean (ns): 4432127
testPersistedJobReading_fewJobs_goodRTC_median (ns): 4395469
com.android.frameworks.perftests.job.JobStorePerfTests#testPersistedJobWriting_delta_manyJobs
testPersistedJobWriting_delta_manyJobs_mean (ns): 42629601
testPersistedJobWriting_delta_manyJobs_median (ns): 42282061
com.android.frameworks.perftests.job.JobStorePerfTests#testPersistedJobWriting_delta_fewJobs
testPersistedJobWriting_delta_fewJobs_mean (ns): 5070691
testPersistedJobWriting_delta_fewJobs_median (ns): 4914688
com.android.frameworks.perftests.job.JobStorePerfTests#testPersistedJobReading_manyJobs_badRTC
testPersistedJobReading_manyJobs_badRTC_mean (ns): 45184576
testPersistedJobReading_manyJobs_badRTC_median (ns): 44922660
(With split files):
com.android.frameworks.perftests.job.JobStorePerfTests#testPersistedJobReading_fewJobs_badRTC
testPersistedJobReading_fewJobs_badRTC_mean (ns): 6350549
testPersistedJobReading_fewJobs_badRTC_median (ns): 6232605
com.android.frameworks.perftests.job.JobStorePerfTests#testPersistedJobWriting_manyJobs
testPersistedJobWriting_manyJobs_mean (ns): 39963524
testPersistedJobWriting_manyJobs_median (ns): 39628389
com.android.frameworks.perftests.job.JobStorePerfTests#testPersistedJobReading_manyJobs_goodRTC
testPersistedJobReading_manyJobs_goodRTC_mean (ns): 43956702
testPersistedJobReading_manyJobs_goodRTC_median (ns): 43569874
com.android.frameworks.perftests.job.JobStorePerfTests#testPersistedJobWriting_fewJobs
testPersistedJobWriting_fewJobs_mean (ns): 8250152
testPersistedJobWriting_fewJobs_median (ns): 8090939
com.android.frameworks.perftests.job.JobStorePerfTests#testPersistedJobReading_fewJobs_goodRTC
testPersistedJobReading_fewJobs_goodRTC_mean (ns): 6006753
testPersistedJobReading_fewJobs_goodRTC_median (ns): 5869193
com.android.frameworks.perftests.job.JobStorePerfTests#testPersistedJobWriting_delta_manyJobs
testPersistedJobWriting_delta_manyJobs_mean (ns): 26459508
testPersistedJobWriting_delta_manyJobs_median (ns): 26147607
com.android.frameworks.perftests.job.JobStorePerfTests#testPersistedJobWriting_delta_fewJobs
testPersistedJobWriting_delta_fewJobs_mean (ns): 4958038
testPersistedJobWriting_delta_fewJobs_median (ns): 4881588
com.android.frameworks.perftests.job.JobStorePerfTests#testPersistedJobReading_manyJobs_badRTC
testPersistedJobReading_manyJobs_badRTC_mean (ns): 44476839
testPersistedJobReading_manyJobs_badRTC_median (ns): 43993285
Bug: 255352252
Test: atest JobSchedulerPerfTests:JobStorePerfTests
Test: atest FrameworksServicesTests:JobStoreTest
Change-Id: Ib7bfa2c974f7663dea79d707c9e1b2bd53ef89b3