Merge "Logging and partial fix for BatteryStats lock contention"

This commit is contained in:
Ian Pedowitz
2017-02-08 02:02:12 +00:00
committed by Android (Google) Code Review

View File

@@ -9562,7 +9562,8 @@ public class BatteryStatsImpl extends BatteryStats {
}
});
if (DEBUG_ENERGY_CPU) {
// TODO: STOPSHIP, remove the "true" below after b/34961340 is fixed
if (DEBUG_ENERGY_CPU || true) {
Slog.d(TAG, "Reading cpu stats took " + (mClocks.elapsedRealtime() - startTimeMs) +
" ms");
}
@@ -10390,10 +10391,9 @@ public class BatteryStatsImpl extends BatteryStats {
if (next == null) {
return;
}
mWriteLock.lock();
}
mWriteLock.lock();
try {
FileOutputStream stream = new FileOutputStream(mFile.chooseForWrite());
stream.write(next.marshall());