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

Commit ce4005ac authored by Blake Kragten's avatar Blake Kragten
Browse files

Power Monitor Addition frameworks telephony:

Adding additional fields to telephony metrics to record the power
monitored on cellular rails. This metric will allow us to better isolate
where our actual power usage is during modem use cases. This can be
directly compared with ModemPowerStats energyConsumedMah. Thus, having
this metric in telephony stats is vital in the comparsion on already
calculated power usage. BatteryStats collects and reports the power
monitored rail data to telephony metrics using ModemPowerMetrics.

If a device does not support rail power monitoring then this value may
remain at 0.

Bug: 115929961
Test: adb shell dumpsys activity service TelephonyDebugService --metrics
Results Examples:
        Energy consumed by modem (mAh): 2.41
        Energy consumed across measured modem rails (mAh): 2.76
Dumpsys Example:
	  +4m23s712ms (2) 100 cc511a18 modemRailChargemAh=0.34 wifiRailChargemAh=1.17 +wifi_scan stats=0:"dump"
         +10m24s089ms (2) 100 c4511a18 modemRailChargemAh=0.71 wifiRailChargemAh=1.77 stats=0:"write"
         +11m24s228ms (3) 100 c4511a19 volt=4315 charge=3988 modemRailChargemAh=0.77 wifiRailChargemAh=1.94 wifi_signal_strength=2 stats=0:"battery-state"

Change-Id: I2b1a20950e118f675fed45b40785128477711268
parent e03bece3
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -2275,4 +2275,7 @@ message ModemPowerStats {
  // Amount of time phone spends in various cellular
  // rx signal strength levels (ms)
  repeated int64 time_in_rx_signal_strength_level_ms = 14;

  // Actual monitored rail energy consumed by modem (mAh)
  optional double monitored_rail_energy_consumed_mah = 15;
}
+2 −0
Original line number Diff line number Diff line
@@ -70,6 +70,8 @@ public class ModemPowerMetrics {
            long[] trx = stats.getTimeInRxSignalStrengthLevelMs();
            m.timeInRxSignalStrengthLevelMs = new long[trx.length];
            System.arraycopy(trx, 0, m.timeInRxSignalStrengthLevelMs, 0, trx.length);
            m.monitoredRailEnergyConsumedMah = stats.getMonitoredRailChargeConsumedMaMs()
                / ((double) DateUtils.HOUR_IN_MILLIS);
        }
        return m;
    }
+3 −0
Original line number Diff line number Diff line
@@ -101,6 +101,7 @@ import com.android.internal.util.IndentingPrintWriter;

import java.io.FileDescriptor;
import java.io.PrintWriter;
import java.text.DecimalFormat;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
@@ -534,6 +535,8 @@ public class TelephonyMetrics {
        pw.println("Amount of time phone spent in various cellular "
                + "rx signal strength levels (ms): "
                + Arrays.toString(s.timeInRxSignalStrengthLevelMs));
        pw.println("Energy consumed across measured modem rails (mAh): "
                + new DecimalFormat("#.##").format(s.monitoredRailEnergyConsumedMah));
        pw.decreaseIndent();
        pw.println("Hardware Version: " + SystemProperties.get("ro.boot.revision", ""));
    }