Home
last modified time | relevance | path

Searched refs:BatteryStats (Results 1 – 25 of 68) sorted by relevance

123

/frameworks/base/core/tests/coretests/src/com/android/internal/os/
DBatteryStatsSamplingTimerTest.java19 import android.os.BatteryStats;
43 assertEquals(1, timer.getCountLocked(BatteryStats.STATS_SINCE_CHARGED)); in testSettingStalePreservesData()
44 assertEquals(10, timer.getTotalTimeLocked(200, BatteryStats.STATS_SINCE_CHARGED)); in testSettingStalePreservesData()
48 assertEquals(1, timer.getCountLocked(BatteryStats.STATS_SINCE_CHARGED)); in testSettingStalePreservesData()
49 assertEquals(10, timer.getTotalTimeLocked(200, BatteryStats.STATS_SINCE_CHARGED)); in testSettingStalePreservesData()
53 assertEquals(1, timer.getCountLocked(BatteryStats.STATS_SINCE_CHARGED)); in testSettingStalePreservesData()
54 assertEquals(10, timer.getTotalTimeLocked(200, BatteryStats.STATS_SINCE_CHARGED)); in testSettingStalePreservesData()
69 assertEquals(0, timer.getCountLocked(BatteryStats.STATS_SINCE_CHARGED)); in testEndSampleAndContinueWhenTimeOrCountDecreases()
70 assertEquals(0, timer.getTotalTimeLocked(200, BatteryStats.STATS_SINCE_CHARGED)); in testEndSampleAndContinueWhenTimeOrCountDecreases()
76 assertEquals(0, timer.getCountLocked(BatteryStats.STATS_SINCE_CHARGED)); in testEndSampleAndContinueWhenTimeOrCountDecreases()
[all …]
DBatteryStatsStopwatchTimerTest.java19 import android.os.BatteryStats;
38 null, BatteryStats.SENSOR, null, timeBase); in testCount()
47 assertEquals(expectedCount, timer.getCountLocked(BatteryStats.STATS_SINCE_CHARGED)); in testCount()
49 assertEquals(expectedCount, timer.getCountLocked(BatteryStats.STATS_SINCE_CHARGED)); in testCount()
51 assertEquals(expectedCount, timer.getCountLocked(BatteryStats.STATS_SINCE_CHARGED)); in testCount()
53 assertEquals(expectedCount, timer.getCountLocked(BatteryStats.STATS_SINCE_CHARGED)); in testCount()
58 assertEquals(expectedCount, timer.getCountLocked(BatteryStats.STATS_SINCE_CHARGED)); in testCount()
66 assertEquals(expectedCount, timer.getCountLocked(BatteryStats.STATS_SINCE_CHARGED)); in testCount()
69 assertEquals(expectedCount, timer.getCountLocked(BatteryStats.STATS_SINCE_CHARGED)); in testCount()
75 assertEquals(expectedCount, timer.getCountLocked(BatteryStats.STATS_SINCE_CHARGED)); in testCount()
[all …]
DBatteryStatsSensorTest.java20 import android.os.BatteryStats;
58 BatteryStats.Timer sensorTimer = bi.getUidStats().get(UID).getSensorStats() in testSensorStartStop()
60 BatteryStats.Timer sensorBgTimer = bi.getUidStats().get(UID).getSensorStats() in testSensorStartStop()
63 assertEquals(2, sensorTimer.getCountLocked(BatteryStats.STATS_SINCE_CHARGED)); in testSensorStartStop()
65 clocks.realtime * 1000, BatteryStats.STATS_SINCE_CHARGED)); in testSensorStartStop()
67 assertEquals(1, sensorBgTimer.getCountLocked(BatteryStats.STATS_SINCE_CHARGED)); in testSensorStartStop()
69 clocks.realtime * 1000, BatteryStats.STATS_SINCE_CHARGED)); in testSensorStartStop()
89 BatteryStats.Timer sensorTimer = bi.getUidStats().get(UID).getSensorStats() in testCountingWhileOffBattery()
92 sensorTimer.getTotalTimeLocked(curr, BatteryStats.STATS_SINCE_CHARGED)); in testCountingWhileOffBattery()
93 assertEquals(0, sensorTimer.getCountLocked(BatteryStats.STATS_SINCE_CHARGED)); in testCountingWhileOffBattery()
[all …]
DBatteryStatsCounterTest.java19 import android.os.BatteryStats;
46 assertEquals(0, counter.getCountLocked(BatteryStats.STATS_SINCE_CHARGED)); in testCounter()
54 assertEquals(4, counter.getCountLocked(BatteryStats.STATS_SINCE_CHARGED)); in testCounter()
61 assertEquals(4, counter.getCountLocked(BatteryStats.STATS_SINCE_CHARGED)); in testCounter()
67 assertEquals(6, counter.getCountLocked(BatteryStats.STATS_SINCE_CHARGED)); in testCounter()
82 assertEquals(3, origCounter.getCountLocked(BatteryStats.STATS_SINCE_CHARGED)); in testParceling()
94 assertEquals(4, summaryCounter.getCountLocked(BatteryStats.STATS_SINCE_CHARGED)); in testParceling()
99 assertEquals(4, summaryCounter.getCountLocked(BatteryStats.STATS_SINCE_CHARGED)); in testParceling()
104 assertEquals(6, summaryCounter.getCountLocked(BatteryStats.STATS_SINCE_CHARGED)); in testParceling()
116 assertEquals(7, fullParcelCounter.getCountLocked(BatteryStats.STATS_SINCE_CHARGED)); in testParceling()
[all …]
DPowerCalculatorTest.java23 import android.os.BatteryStats;
55 BatteryStats.Uid u = mock(BatteryStats.Uid.class); in testMediaPowerCalculator()
56 BatteryStats.Timer audioTimer = mock(BatteryStats.Timer.class); in testMediaPowerCalculator()
59 BatteryStats.Timer videoTimer = mock(BatteryStats.Timer.class); in testMediaPowerCalculator()
DBatteryStatsImplTest.java19 import static android.os.BatteryStats.STATS_SINCE_CHARGED;
20 import static android.os.BatteryStats.Uid.NUM_PROCESS_STATE;
21 import static android.os.BatteryStats.Uid.PROCESS_STATE_BACKGROUND;
22 import static android.os.BatteryStats.Uid.PROCESS_STATE_CACHED;
23 import static android.os.BatteryStats.Uid.PROCESS_STATE_FOREGROUND_SERVICE;
24 import static android.os.BatteryStats.Uid.PROCESS_STATE_TOP;
34 import android.os.BatteryStats;
98 final BatteryStats.Uid u = mBatteryStatsImpl.getUidStatsLocked(testUids[i]); in testUpdateProcStateCpuTimes()
109 final BatteryStats.Uid u = mBatteryStatsImpl.getUidStats().get(testUids[i]); in testUpdateProcStateCpuTimes()
136 final BatteryStats.Uid u = mBatteryStatsImpl.getUidStats().get(testUids[i]); in testUpdateProcStateCpuTimes()
[all …]
DBatteryStatsDurationTimerTest.java19 import android.os.BatteryStats;
42 null, BatteryStats.WAKE_TYPE_PARTIAL, null, timeBase); in testStartStop()
114 null, BatteryStats.WAKE_TYPE_PARTIAL, null, timeBase); in testReset()
150 null, BatteryStats.WAKE_TYPE_PARTIAL, null, timeBase); in testResetAndDetach()
177 null, BatteryStats.WAKE_TYPE_PARTIAL, null, timeBase); in testParceling()
198 null, BatteryStats.WAKE_TYPE_PARTIAL, null, timeBase); in testParceling()
216 null, BatteryStats.WAKE_TYPE_PARTIAL, null, timeBase, fullParcel); in testParceling()
DBatteryStatsNoteTest.java19 import static android.os.BatteryStats.STATS_SINCE_CHARGED;
20 import static android.os.BatteryStats.WAKE_TYPE_PARTIAL;
23 import android.os.BatteryStats;
24 import android.os.BatteryStats.HistoryItem;
25 import android.os.BatteryStats.Uid.Sensor;
70 BatteryStats.Counter bgCntr = bi.getUidStats().get(UID).getBluetoothScanResultBgCounter(); in testNoteBluetoothScanResultLocked()
107 BatteryStats.Timer aggregTimer = bi.getUidStats().get(UID) in testNoteStartWakeLocked()
153 BatteryStats.Uid uid = bi.getUidStats().get(UID); in testNoteUidProcessStateLocked()
156 actualRunTimeUs = uid.getProcessStateTime(BatteryStats.Uid.PROCESS_STATE_TOP, elapsedTimeUs, in testNoteUidProcessStateLocked()
161 actualRunTimeUs = uid.getProcessStateTime(BatteryStats.Uid.PROCESS_STATE_FOREGROUND_SERVICE, in testNoteUidProcessStateLocked()
[all …]
DBatteryStatsBackgroundStatsTest.java19 import static android.os.BatteryStats.STATS_SINCE_CHARGED;
22 import android.os.BatteryStats;
255 BatteryStats.Timer timer = bi.getUidStats().get(UID).getBluetoothScanTimer(); in doTestAppBluetoothScanInternal()
256 BatteryStats.Timer bgTimer = bi.getUidStats().get(UID).getBluetoothScanBackgroundTimer(); in doTestAppBluetoothScanInternal()
257 BatteryStats.Timer badTimer = bi.getUidStats().get(UID).getBluetoothUnoptimizedScanTimer(); in doTestAppBluetoothScanInternal()
258 BatteryStats.Timer badBgTimer = bi.getUidStats().get(UID) in doTestAppBluetoothScanInternal()
316 final ArrayMap<String, ? extends BatteryStats.Timer> jobs = in testJob()
319 BatteryStats.Timer timer = jobs.valueAt(0); in testJob()
320 BatteryStats.Timer bgTimer = timer.getSubTimer(); in testJob()
377 final ArrayMap<String, ? extends BatteryStats.Timer> syncs = in testSyncs()
[all …]
DBatteryStatsCpuTimesTest.java19 import static android.os.BatteryStats.STATS_SINCE_CHARGED;
20 import static android.os.BatteryStats.WAKE_TYPE_PARTIAL;
38 import android.os.BatteryStats;
233 final BatteryStats.Uid u = mBatteryStatsImpl.getUidStats().get(testUids[i]); in testUpdateClusterSpeedTimes()
276 final BatteryStats.Uid u = mBatteryStatsImpl.getUidStats().get(testUids[i]); in testReadKernelUidCpuTimesLocked()
310 final BatteryStats.Uid u = mBatteryStatsImpl.getUidStats().get(testUids[i]); in testReadKernelUidCpuTimesLocked()
350 final BatteryStats.Uid u = mBatteryStatsImpl.getUidStats().get(testUids[i]); in testReadKernelUidCpuTimesLocked_isolatedUid()
386 BatteryStats.Uid u = mBatteryStatsImpl.getUidStats().get(testUids[i]); in testReadKernelUidCpuTimesLocked_isolatedUid()
442 final BatteryStats.Uid u = mBatteryStatsImpl.getUidStats().get(testUids[i]); in testReadKernelUidCpuTimesLocked_invalidUid()
492 final BatteryStats.Uid u = mBatteryStatsImpl.getUidStats().get(testUids[i]); in testReadKernelUidCpuTimesLocked_withPartialTimers()
[all …]
DBatteryStatsHelperTest.java20 import static android.os.BatteryStats.Uid.PROCESS_STATE_TOP;
37 import android.os.BatteryStats;
79 private BatteryStats.Uid mUid;
258 BatteryStats.STATS_SINCE_CHARGED); in testGetProcessForegroundTimeMs_largerActivityTime_returnMinTime()
300 final BatteryStats.Uid uid = mock(BatteryStats.Uid.class, RETURNS_DEEP_STUBS); in createTestSmearBatterySipper()
/frameworks/base/services/core/java/com/android/server/am/
DHealthStatsBatteryStatsWriter.java19 import android.os.BatteryStats;
20 import static android.os.BatteryStats.STATS_SINCE_CHARGED;
50 public void writeUid(HealthStatsWriter uidWriter, BatteryStats bs, BatteryStats.Uid uid) { in writeUid()
52 BatteryStats.Timer timer; in writeUid()
53 SparseArray<? extends BatteryStats.Uid.Sensor> sensors; in writeUid()
54 SparseArray<? extends BatteryStats.Uid.Pid> pids; in writeUid()
55 BatteryStats.ControllerActivityCounter controller; in writeUid()
85 for (final Map.Entry<String,? extends BatteryStats.Uid.Wakelock> entry: in writeUid()
88 final BatteryStats.Uid.Wakelock wakelock = entry.getValue(); in writeUid()
91 timer = wakelock.getWakeTime(BatteryStats.WAKE_TYPE_FULL); in writeUid()
[all …]
/frameworks/base/core/java/com/android/internal/os/
DMobileRadioPowerCalculator.java18 import android.os.BatteryStats;
28 private BatteryStats mStats;
38 final long mobileRx = mStats.getNetworkActivityPackets(BatteryStats.NETWORK_MOBILE_RX_DATA, in getMobilePowerPerPacket()
40 final long mobileTx = mStats.getNetworkActivityPackets(BatteryStats.NETWORK_MOBILE_TX_DATA, in getMobilePowerPerPacket()
52 public MobileRadioPowerCalculator(PowerProfile profile, BatteryStats stats) { in MobileRadioPowerCalculator()
84 public void calculateApp(BatterySipper app, BatteryStats.Uid u, long rawRealtimeUs, in calculateApp()
87 app.mobileRxPackets = u.getNetworkActivityPackets(BatteryStats.NETWORK_MOBILE_RX_DATA, in calculateApp()
89 app.mobileTxPackets = u.getNetworkActivityPackets(BatteryStats.NETWORK_MOBILE_TX_DATA, in calculateApp()
93 app.mobileRxBytes = u.getNetworkActivityBytes(BatteryStats.NETWORK_MOBILE_RX_DATA, in calculateApp()
95 app.mobileTxBytes = u.getNetworkActivityBytes(BatteryStats.NETWORK_MOBILE_TX_DATA, in calculateApp()
[all …]
DWifiPowerCalculator.java18 import android.os.BatteryStats;
41 public void calculateApp(BatterySipper app, BatteryStats.Uid u, long rawRealtimeUs, in calculateApp()
43 final BatteryStats.ControllerActivityCounter counter = u.getWifiControllerActivity(); in calculateApp()
59 app.wifiRxPackets = u.getNetworkActivityPackets(BatteryStats.NETWORK_WIFI_RX_DATA, in calculateApp()
61 app.wifiTxPackets = u.getNetworkActivityPackets(BatteryStats.NETWORK_WIFI_TX_DATA, in calculateApp()
63 app.wifiRxBytes = u.getNetworkActivityBytes(BatteryStats.NETWORK_WIFI_RX_DATA, in calculateApp()
65 app.wifiTxBytes = u.getNetworkActivityBytes(BatteryStats.NETWORK_WIFI_TX_DATA, in calculateApp()
75 public void calculateRemaining(BatterySipper app, BatteryStats stats, long rawRealtimeUs, in calculateRemaining()
77 final BatteryStats.ControllerActivityCounter counter = stats.getWifiControllerActivity(); in calculateRemaining()
DSensorPowerCalculator.java20 import android.os.BatteryStats;
32 BatteryStats stats, long rawRealtimeUs, int statsType) { in SensorPowerCalculator()
38 public void calculateApp(BatterySipper app, BatteryStats.Uid u, long rawRealtimeUs, in calculateApp()
41 final SparseArray<? extends BatteryStats.Uid.Sensor> sensorStats = u.getSensorStats(); in calculateApp()
44 final BatteryStats.Uid.Sensor sensor = sensorStats.valueAt(ise); in calculateApp()
46 final BatteryStats.Timer timer = sensor.getSensorTime(); in calculateApp()
50 case BatteryStats.Uid.Sensor.GPS: in calculateApp()
68 private double getAverageGpsPower(PowerProfile profile, BatteryStats stats, long rawRealtimeUs, in getAverageGpsPower()
DWakelockPowerCalculator.java18 import android.os.BatteryStats;
33 public void calculateApp(BatterySipper app, BatteryStats.Uid u, long rawRealtimeUs, in calculateApp()
36 final ArrayMap<String, ? extends BatteryStats.Uid.Wakelock> wakelockStats = in calculateApp()
40 final BatteryStats.Uid.Wakelock wakelock = wakelockStats.valueAt(i); in calculateApp()
44 BatteryStats.Timer timer = wakelock.getWakeTime(BatteryStats.WAKE_TYPE_PARTIAL); in calculateApp()
61 public void calculateRemaining(BatterySipper app, BatteryStats stats, long rawRealtimeUs, in calculateRemaining()
DWifiPowerEstimator.java18 import android.os.BatteryStats;
51 public void calculateApp(BatterySipper app, BatteryStats.Uid u, long rawRealtimeUs, in calculateApp()
53 app.wifiRxPackets = u.getNetworkActivityPackets(BatteryStats.NETWORK_WIFI_RX_DATA, in calculateApp()
55 app.wifiTxPackets = u.getNetworkActivityPackets(BatteryStats.NETWORK_WIFI_TX_DATA, in calculateApp()
57 app.wifiRxBytes = u.getNetworkActivityBytes(BatteryStats.NETWORK_WIFI_RX_DATA, in calculateApp()
59 app.wifiTxBytes = u.getNetworkActivityBytes(BatteryStats.NETWORK_WIFI_TX_DATA, in calculateApp()
73 for (int bin = 0; bin < BatteryStats.Uid.NUM_WIFI_BATCHED_SCAN_BINS; bin++) { in calculateApp()
88 public void calculateRemaining(BatterySipper app, BatteryStats stats, long rawRealtimeUs, in calculateRemaining()
DBluetoothPowerCalculator.java18 import android.os.BatteryStats;
37 public void calculateApp(BatterySipper app, BatteryStats.Uid u, long rawRealtimeUs, in calculateApp()
40 final BatteryStats.ControllerActivityCounter counter = u.getBluetoothControllerActivity(); in calculateApp()
59 app.btRxBytes = u.getNetworkActivityBytes(BatteryStats.NETWORK_BT_RX_DATA, statsType); in calculateApp()
60 app.btTxBytes = u.getNetworkActivityBytes(BatteryStats.NETWORK_BT_TX_DATA, statsType); in calculateApp()
67 public void calculateRemaining(BatterySipper app, BatteryStats stats, long rawRealtimeUs, in calculateRemaining()
69 final BatteryStats.ControllerActivityCounter counter = in calculateRemaining()
DMediaPowerCalculator.java18 import android.os.BatteryStats;
36 public void calculateApp(BatterySipper app, BatteryStats.Uid u, long rawRealtimeUs, in calculateApp()
40 final BatteryStats.Timer audioTimer = u.getAudioTurnedOnTimer(); in calculateApp()
51 final BatteryStats.Timer videoTimer = u.getVideoTurnedOnTimer(); in calculateApp()
DPowerCalculator.java18 import android.os.BatteryStats;
35 public abstract void calculateApp(BatterySipper app, BatteryStats.Uid u, long rawRealtimeUs, in calculateApp()
49 public void calculateRemaining(BatterySipper app, BatteryStats stats, long rawRealtimeUs, in calculateRemaining()
DFlashlightPowerCalculator.java18 import android.os.BatteryStats;
31 public void calculateApp(BatterySipper app, BatteryStats.Uid u, long rawRealtimeUs, in calculateApp()
36 final BatteryStats.Timer timer = u.getFlashlightTurnedOnTimer(); in calculateApp()
DCameraPowerCalculator.java18 import android.os.BatteryStats;
33 public void calculateApp(BatterySipper app, BatteryStats.Uid u, long rawRealtimeUs, in calculateApp()
38 final BatteryStats.Timer timer = u.getCameraTurnedOnTimer(); in calculateApp()
DMemoryPowerCalculator.java3 import android.os.BatteryStats;
25 public void calculateApp(BatterySipper app, BatteryStats.Uid u, long rawRealtimeUs, in calculateApp()
29 public void calculateRemaining(BatterySipper app, BatteryStats stats, long rawRealtimeUs, in calculateRemaining()
33 LongSparseArray<? extends BatteryStats.Timer> timers = stats.getKernelMemoryStats(); in calculateRemaining()
DBatteryStatsHelper.java27 import android.os.BatteryStats;
28 import android.os.BatteryStats.Uid;
71 private static BatteryStats sStatsXfer;
73 private static ArrayMap<File, BatteryStats> sFileXfer = new ArrayMap<>();
81 private BatteryStats mStats;
110 private int mStatsType = BatteryStats.STATS_SINCE_CHARGED;
158 public static boolean checkHasWifiPowerReporting(BatteryStats stats, PowerProfile profile) { in checkHasWifiPowerReporting()
165 public static boolean checkHasBluetoothPowerReporting(BatteryStats stats, in checkHasBluetoothPowerReporting()
221 public static BatteryStats statsFromFile(Context context, String fname) { in statsFromFile()
224 BatteryStats stats = sFileXfer.get(path); in statsFromFile()
[all …]
DCpuPowerCalculator.java18 import android.os.BatteryStats;
33 public void calculateApp(BatterySipper app, BatteryStats.Uid u, long rawRealtimeUs, in calculateApp()
84 final ArrayMap<String, ? extends BatteryStats.Uid.Proc> processStats = u.getProcessStats(); in calculateApp()
87 final BatteryStats.Uid.Proc ps = processStats.valueAt(i); in calculateApp()

123