traced_probes: Implement BatteryCounters for CrOS and Linux
CrOS and Linux doesn't have the Android hwbinder for getting battery
counters. Implement data source "linux.sysfs_power" that reads the
counters from sysfs (e.g. /sys/class/power_supply/BAT0) entries:
* capacity: battery capacity in percentage.
* charge_now: the current coloumb counter value in uAh.
* current_now: the current in uA.
* current_avg: the smoothed (average over a period) current in uA.
Bug: 204738136
Change-Id: I8f9ddff84967e3a823e83381dee8031720b7ab26
diff --git a/Android.bp b/Android.bp
index 52796f7..497b8ce 100644
--- a/Android.bp
+++ b/Android.bp
@@ -8675,6 +8675,15 @@
name: "perfetto_src_traced_probes_power_power",
srcs: [
"src/traced/probes/power/android_power_data_source.cc",
+ "src/traced/probes/power/linux_power_sysfs_data_source.cc",
+ ],
+}
+
+// GN: //src/traced/probes/power:unittests
+filegroup {
+ name: "perfetto_src_traced_probes_power_unittests",
+ srcs: [
+ "src/traced/probes/power/linux_power_sysfs_data_source_unittest.cc",
],
}
@@ -9389,6 +9398,7 @@
":perfetto_src_traced_probes_packages_list_packages_list_parser",
":perfetto_src_traced_probes_packages_list_unittests",
":perfetto_src_traced_probes_power_power",
+ ":perfetto_src_traced_probes_power_unittests",
":perfetto_src_traced_probes_probes_src",
":perfetto_src_traced_probes_ps_ps",
":perfetto_src_traced_probes_ps_unittests",