Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d4abd1ee authored by Adam Lesinski's avatar Adam Lesinski
Browse files

BatteryStats: Remove reading of cpu power

The cpu power reported by the uid_cputime kernel is inaccurate
and has only ever been recorded for dumping to batterystats.
The values have never been used in power blame calculations.

This change removes these power values which just cause noisy
data.

Bug: 36002715
Change-Id: I61bea9992aabb84d099689360fd9377b44b36e2f
Test: run `adb shell dumpsys batterystats`
Test: should not show `p=` for `Total cpu time:` line
parent 39608b85
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -31903,7 +31903,7 @@ package android.os.health {
    field public static final int MEASUREMENT_BLUETOOTH_TX_MS = 10022; // 0x2726
    field public static final int MEASUREMENT_BLUETOOTH_TX_PACKETS = 10059; // 0x274b
    field public static final int MEASUREMENT_BUTTON_USER_ACTIVITY_COUNT = 10046; // 0x273e
    field public static final int MEASUREMENT_CPU_POWER_MAMS = 10064; // 0x2750
    field public static final deprecated int MEASUREMENT_CPU_POWER_MAMS = 10064; // 0x2750
    field public static final int MEASUREMENT_MOBILE_IDLE_MS = 10024; // 0x2728
    field public static final int MEASUREMENT_MOBILE_POWER_MAMS = 10027; // 0x272b
    field public static final int MEASUREMENT_MOBILE_RX_BYTES = 10048; // 0x2740
+1 −1
Original line number Diff line number Diff line
@@ -34785,7 +34785,7 @@ package android.os.health {
    field public static final int MEASUREMENT_BLUETOOTH_TX_MS = 10022; // 0x2726
    field public static final int MEASUREMENT_BLUETOOTH_TX_PACKETS = 10059; // 0x274b
    field public static final int MEASUREMENT_BUTTON_USER_ACTIVITY_COUNT = 10046; // 0x273e
    field public static final int MEASUREMENT_CPU_POWER_MAMS = 10064; // 0x2750
    field public static final deprecated int MEASUREMENT_CPU_POWER_MAMS = 10064; // 0x2750
    field public static final int MEASUREMENT_MOBILE_IDLE_MS = 10024; // 0x2728
    field public static final int MEASUREMENT_MOBILE_POWER_MAMS = 10027; // 0x272b
    field public static final int MEASUREMENT_MOBILE_RX_BYTES = 10048; // 0x2740
+1 −1
Original line number Diff line number Diff line
@@ -32041,7 +32041,7 @@ package android.os.health {
    field public static final int MEASUREMENT_BLUETOOTH_TX_MS = 10022; // 0x2726
    field public static final int MEASUREMENT_BLUETOOTH_TX_PACKETS = 10059; // 0x274b
    field public static final int MEASUREMENT_BUTTON_USER_ACTIVITY_COUNT = 10046; // 0x273e
    field public static final int MEASUREMENT_CPU_POWER_MAMS = 10064; // 0x2750
    field public static final deprecated int MEASUREMENT_CPU_POWER_MAMS = 10064; // 0x2750
    field public static final int MEASUREMENT_MOBILE_IDLE_MS = 10024; // 0x2728
    field public static final int MEASUREMENT_MOBILE_POWER_MAMS = 10027; // 0x272b
    field public static final int MEASUREMENT_MOBILE_RX_BYTES = 10048; // 0x2740
+3 −13
Original line number Diff line number Diff line
@@ -593,11 +593,6 @@ public abstract class BatteryStats implements Parcelable {
         */
        public abstract long getSystemCpuTimeUs(int which);

        /**
         * Get the total cpu power consumed (in milli-ampere-microseconds).
         */
        public abstract long getCpuPowerMaUs(int which);

        /**
         * Returns the approximate cpu time (in milliseconds) spent at a certain CPU speed for a
         * given CPU cluster.
@@ -3467,10 +3462,9 @@ public abstract class BatteryStats implements Parcelable {

            final long userCpuTimeUs = u.getUserCpuTimeUs(which);
            final long systemCpuTimeUs = u.getSystemCpuTimeUs(which);
            final long powerCpuMaUs = u.getCpuPowerMaUs(which);
            if (userCpuTimeUs > 0 || systemCpuTimeUs > 0 || powerCpuMaUs > 0) {
            if (userCpuTimeUs > 0 || systemCpuTimeUs > 0) {
                dumpLine(pw, uid, category, CPU_DATA, userCpuTimeUs / 1000, systemCpuTimeUs / 1000,
                        powerCpuMaUs / 1000);
                        0 /* old cpu power, keep for compatibility */);
            }

            final ArrayMap<String, ? extends BatteryStats.Uid.Proc> processStats
@@ -4758,17 +4752,13 @@ public abstract class BatteryStats implements Parcelable {

            final long userCpuTimeUs = u.getUserCpuTimeUs(which);
            final long systemCpuTimeUs = u.getSystemCpuTimeUs(which);
            final long powerCpuMaUs = u.getCpuPowerMaUs(which);
            if (userCpuTimeUs > 0 || systemCpuTimeUs > 0 || powerCpuMaUs > 0) {
            if (userCpuTimeUs > 0 || systemCpuTimeUs > 0) {
                sb.setLength(0);
                sb.append(prefix);
                sb.append("    Total cpu time: u=");
                formatTimeMs(sb, userCpuTimeUs / 1000);
                sb.append("s=");
                formatTimeMs(sb, systemCpuTimeUs / 1000);
                sb.append("p=");
                printmAh(sb, powerCpuMaUs / (1000.0 * 1000.0 * 60.0 * 60.0));
                sb.append("mAh");
                pw.println(sb.toString());
            }

+3 −0
Original line number Diff line number Diff line
@@ -445,7 +445,10 @@ public final class UidHealthStats {

    /**
     * An estimate of the number of milliamp-microsends used by this uid.
     *
     * @deprecated this measurement is vendor-dependent and not reliable.
     */
    @Deprecated
    @HealthKeys.Constant(type=HealthKeys.TYPE_MEASUREMENT)
    public static final int MEASUREMENT_CPU_POWER_MAMS = HealthKeys.BASE_UID + 64;

Loading