1690a62b71936aa4c9f555858e0560ddaf8e54ba |
|
23-Jan-2018 |
Enrico Granata <egranata@google.com> |
Implement logic in CarStorageMonitoringManager to detect the cost (in terms of disk I/O) of the previous shutdown ext4 and f2fs offer lifetime_write_kbytes files via sysfs that let userspace discover the amount of data written to each individual partition throughout its lifetime. Using this information, we execute this algorithm: - when CarService goes down, store lifetime_write_kbytes info for all mounted partitions; - at the next boot, calculate lifetime_write_kbytes for all mounted partitions again; - for every partition that existed at both shutdown and reboot, calculate the difference of the written amount; - add up those deltas: this is the total amount of writes since CarService went down; - take the aggregate UID I/O activity, and add up all bytes written to disk inferred from there: this is the cost of getting where we are; - subtract this aggregate from the previously computed total delta: this is a fair approximation of the cost of shutdown Test: tests in carservice_test and carservice_unit_test Bug: 32512551 Change-Id: Ia791eaa1fdb4bf026c1760e2bd333c30a413721f Fixes: 72236603
/packages/services/Car/service/src/com/android/car/OnShutdownReboot.java
|