Merge "Read cpu freq data only when needed." into oc-dev
am: fdeb6b8ed3
Change-Id: I241535a379b8e3cf547d73c05fe0dc7298ccc958
This commit is contained in:
@@ -185,7 +185,7 @@ public class BatteryStatsImpl extends BatteryStats {
|
||||
switch (msg.what) {
|
||||
case MSG_UPDATE_WAKELOCKS:
|
||||
synchronized (BatteryStatsImpl.this) {
|
||||
updateCpuTimeLocked();
|
||||
updateCpuTimeLocked(false /* updateCpuFreqData */);
|
||||
}
|
||||
if (cb != null) {
|
||||
cb.batteryNeedsCpuUpdate();
|
||||
@@ -3480,7 +3480,7 @@ public class BatteryStatsImpl extends BatteryStats {
|
||||
Slog.d(TAG, "Updating cpu time because screen is now " +
|
||||
(unpluggedScreenOff ? "off" : "on"));
|
||||
}
|
||||
updateCpuTimeLocked();
|
||||
updateCpuTimeLocked(true /* updateCpuFreqData */);
|
||||
mOnBatteryScreenOffTimeBase.setRunning(unpluggedScreenOff, uptime, realtime);
|
||||
for (int i = 0; i < mUidStats.size(); i++) {
|
||||
mUidStats.valueAt(i).updateOnBatteryScreenOffBgTimeBase(uptime, realtime);
|
||||
@@ -10002,7 +10002,7 @@ public class BatteryStatsImpl extends BatteryStats {
|
||||
* and we are on battery with screen off, we give more of the cpu time to those apps holding
|
||||
* wakelocks. If the screen is on, we just assign the actual cpu time an app used.
|
||||
*/
|
||||
public void updateCpuTimeLocked() {
|
||||
public void updateCpuTimeLocked(boolean updateCpuFreqData) {
|
||||
if (mPowerProfile == null) {
|
||||
return;
|
||||
}
|
||||
@@ -10117,7 +10117,9 @@ public class BatteryStatsImpl extends BatteryStats {
|
||||
}
|
||||
});
|
||||
|
||||
readKernelUidCpuFreqTimesLocked();
|
||||
if (updateCpuFreqData) {
|
||||
readKernelUidCpuFreqTimesLocked();
|
||||
}
|
||||
|
||||
final long elapse = (mClocks.elapsedRealtime() - startTimeMs);
|
||||
if (DEBUG_ENERGY_CPU || (elapse >= 100)) {
|
||||
|
||||
@@ -16,6 +16,8 @@
|
||||
|
||||
package com.android.server.am;
|
||||
|
||||
import static com.android.internal.os.BatteryStatsImpl.ExternalStatsSync.UPDATE_CPU;
|
||||
|
||||
import android.annotation.Nullable;
|
||||
import android.bluetooth.BluetoothActivityEnergyInfo;
|
||||
import android.bluetooth.BluetoothAdapter;
|
||||
@@ -1549,7 +1551,9 @@ public final class BatteryStatsService extends IBatteryStats.Stub
|
||||
BatteryStats.HistoryItem.EVENT_COLLECT_EXTERNAL_STATS,
|
||||
reason, 0);
|
||||
|
||||
mStats.updateCpuTimeLocked();
|
||||
if ((updateFlags & UPDATE_CPU) != 0) {
|
||||
mStats.updateCpuTimeLocked(true /* updateCpuFreqData */);
|
||||
}
|
||||
mStats.updateKernelWakelocksLocked();
|
||||
mStats.updateKernelMemoryBandwidthLocked();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user