summaryrefslogtreecommitdiff
path: root/pixelstats/include
diff options
context:
space:
mode:
Diffstat (limited to 'pixelstats/include')
-rw-r--r--pixelstats/include/pixelstats/BatteryEEPROMReporter.h2
-rw-r--r--pixelstats/include/pixelstats/BatteryFGReporter.h82
-rw-r--r--pixelstats/include/pixelstats/DisplayStatsReporter.h77
-rw-r--r--pixelstats/include/pixelstats/SysfsCollector.h10
-rw-r--r--pixelstats/include/pixelstats/UeventListener.h38
5 files changed, 191 insertions, 18 deletions
diff --git a/pixelstats/include/pixelstats/BatteryEEPROMReporter.h b/pixelstats/include/pixelstats/BatteryEEPROMReporter.h
index 41577127..3cb4c5dc 100644
--- a/pixelstats/include/pixelstats/BatteryEEPROMReporter.h
+++ b/pixelstats/include/pixelstats/BatteryEEPROMReporter.h
@@ -45,7 +45,7 @@ class BatteryEEPROMReporter {
public:
BatteryEEPROMReporter();
void checkAndReport(const std::shared_ptr<IStats> &stats_client, const std::string &path);
- void checkAndReportGMSR(const std::shared_ptr<IStats> &stats_client, const std::string &path);
+ void checkAndReportGMSR(const std::shared_ptr<IStats> &stats_client, const std::vector<std::string> &paths);
void checkAndReportMaxfgHistory(const std::shared_ptr<IStats> &stats_client,
const std::string &path);
diff --git a/pixelstats/include/pixelstats/BatteryFGReporter.h b/pixelstats/include/pixelstats/BatteryFGReporter.h
new file mode 100644
index 00000000..9954ada7
--- /dev/null
+++ b/pixelstats/include/pixelstats/BatteryFGReporter.h
@@ -0,0 +1,82 @@
+/*
+ * Copyright (C) 2024 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+ #ifndef HARDWARE_GOOGLE_PIXEL_PIXELSTATS_BATTERYFGREPORTER_H
+ #define HARDWARE_GOOGLE_PIXEL_PIXELSTATS_BATTERYFGREPORTER_H
+
+#include <cstdint>
+#include <string>
+
+#include <aidl/android/frameworks/stats/IStats.h>
+
+namespace android {
+namespace hardware {
+namespace google {
+namespace pixel {
+
+using aidl::android::frameworks::stats::IStats;
+
+class BatteryFGReporter {
+ public:
+ BatteryFGReporter();
+
+ void checkAndReportFGLearning(const std::shared_ptr<IStats> &stats_client, const std::vector<std::string> &paths);
+ void checkAndReportFwUpdate(const std::shared_ptr<IStats> &stats_client, const std::string &path);
+ void checkAndReportFGModelLoading(const std::shared_ptr<IStats> &stats_client, const std::vector<std::string> &paths);
+
+ private:
+ const int kVendorAtomOffset = 2;
+
+ enum FGEventType {
+ EvtFGLearningParams = 0x4C48,
+ EvtFWUpdate = 0x4655,
+ EvtModelLoading = 0x4D4C,
+ };
+
+ struct BatteryFGLearningParam {
+ enum FGEventType type;
+ uint16_t fcnom;
+ uint16_t dpacc;
+ uint16_t dqacc;
+ uint16_t fcrep;
+ uint16_t repsoc;
+ uint16_t msoc;
+ uint16_t vfsoc;
+ uint16_t fstat;
+ uint16_t rcomp0;
+ uint16_t tempco;
+ };
+
+ int64_t report_time_ = 0;
+ int64_t getTimeSecs();
+
+ uint16_t old_learn_params[4] = {0};
+ uint16_t old_fw_update[3] = {0};
+ uint16_t old_model_loading[3] = {0};
+
+ void reportEvent(const std::shared_ptr<IStats> &stats_client,
+ const struct BatteryFGLearningParam &params);
+
+ const int kNumFGLearningFields = 10;
+ const int kNumFwUpdateFields = 3;
+};
+
+} // namespace pixel
+} // namespace google
+} // namespace hardware
+} // namespace android
+
+ #endif // HARDWARE_GOOGLE_PIXEL_PIXELSTATS_BATTERYFGREPORTER_H \ No newline at end of file
diff --git a/pixelstats/include/pixelstats/DisplayStatsReporter.h b/pixelstats/include/pixelstats/DisplayStatsReporter.h
index 35435583..c465c416 100644
--- a/pixelstats/include/pixelstats/DisplayStatsReporter.h
+++ b/pixelstats/include/pixelstats/DisplayStatsReporter.h
@@ -36,29 +36,86 @@ using aidl::android::frameworks::stats::VendorAtomValue;
class DisplayStatsReporter {
public:
DisplayStatsReporter();
+
+ enum display_stats_type {
+ DISP_PANEL_STATE = 0,
+ DISP_PORT_STATE,
+ HDCP_STATE,
+ };
void logDisplayStats(const std::shared_ptr<IStats> &stats_client,
- const std::vector<std::string> &display_stats_paths);
+ const std::vector<std::string> &display_stats_paths,
+ const display_stats_type stats_type);
private:
+ bool readDisplayErrorCount(const std::string &path, int64_t *val);
+ // Proto messages are 1-indexed and VendorAtom field numbers start at 2, so
+ // store everything in the values array at the index of the field number
+ // -2.
+ static constexpr int kVendorAtomOffset = 2;
+ static constexpr int kNumOfDisplayPanelErrorStats = 4;
+
+ int verifyCount(int val, bool *report_stats);
+
+ /* display state */
struct DisplayPanelErrorStats {
int64_t primary_error_count_te;
int64_t primary_error_count_unknown;
int64_t secondary_error_count_te;
int64_t secondary_error_count_unknown;
};
-
- // Proto messages are 1-indexed and VendorAtom field numbers start at 2, so
- // store everything in the values array at the index of the field number
- // -2.
- const int kVendorAtomOffset = 2;
- const int kNumOfDisplayPanelErrorStats = 4;
- struct DisplayPanelErrorStats prev_data_;
-
+ struct DisplayPanelErrorStats prev_panel_data_ = {};
void logDisplayPanelErrorStats(const std::shared_ptr<IStats> &stats_client,
const std::vector<std::string> &display_stats_paths);
bool captureDisplayPanelErrorStats(const std::vector<std::string> &display_stats_paths,
struct DisplayPanelErrorStats *cur_data);
- bool readDisplayPanelErrorCount(const std::string &path, int64_t *val);
+
+ /* displayport state */
+ enum display_port_error_stats_index {
+ LINK_NEGOTIATION_FAILURES = 0,
+ EDID_READ_FAILURES,
+ DPCD_READ_FAILURES,
+ EDID_INVALID_FAILURES,
+ SINK_COUNT_INVALID_FAILURES,
+ LINK_UNSTABLE_FAILURES,
+ DISPLAY_PORT_ERROR_STATS_SIZE,
+ };
+ static constexpr int64_t display_port_error_path_index[DISPLAY_PORT_ERROR_STATS_SIZE] = {
+ PixelAtoms::DisplayPortErrorStats::kLinkNegotiationFailuresFieldNumber,
+ PixelAtoms::DisplayPortErrorStats::kEdidReadFailuresFieldNumber,
+ PixelAtoms::DisplayPortErrorStats::kDpcdReadFailuresFieldNumber,
+ PixelAtoms::DisplayPortErrorStats::kEdidInvalidFailuresFieldNumber,
+ PixelAtoms::DisplayPortErrorStats::kSinkCountInvalidFailuresFieldNumber,
+ PixelAtoms::DisplayPortErrorStats::kLinkUnstableFailuresFieldNumber};
+ int64_t prev_dp_data_[DISPLAY_PORT_ERROR_STATS_SIZE] = {0};
+
+ void logDisplayPortErrorStats(const std::shared_ptr<IStats> &stats_client,
+ const std::vector<std::string> &displayport_stats_paths);
+ bool captureDisplayPortErrorStats(const std::vector<std::string> &displayport_stats_paths,
+ int64_t *cur_data);
+
+ /* HDCP state */
+ enum hdcp_auth_type_stats_index {
+ HDCP2_SUCCESS = 0,
+ HDCP2_FALLBACK,
+ HDCP2_FAIL,
+ HDCP1_SUCCESS,
+ HDCP1_FAIL,
+ HDCP0,
+ HDCP_AUTH_TYPE_STATS_SIZE,
+ };
+ static constexpr int64_t hdcp_auth_type_path_index[HDCP_AUTH_TYPE_STATS_SIZE] = {
+ PixelAtoms::HDCPAuthTypeStats::kHdcp2SuccessCountFieldNumber,
+ PixelAtoms::HDCPAuthTypeStats::kHdcp2FallbackCountFieldNumber,
+ PixelAtoms::HDCPAuthTypeStats::kHdcp2FailCountFieldNumber,
+ PixelAtoms::HDCPAuthTypeStats::kHdcp1SuccessCountFieldNumber,
+ PixelAtoms::HDCPAuthTypeStats::kHdcp1FailCountFieldNumber,
+ PixelAtoms::HDCPAuthTypeStats::kHdcp0CountFieldNumber};
+ int64_t prev_hdcp_data_[HDCP_AUTH_TYPE_STATS_SIZE] = {0};
+
+ void logHDCPAuthTypeStats(const std::shared_ptr<IStats> &stats_client,
+ const std::vector<std::string> &hdcp_stats_paths);
+ bool captureHDCPAuthTypeStats(const std::vector<std::string> &hdcp_stats_paths,
+ int64_t *cur_data);
};
} // namespace pixel
diff --git a/pixelstats/include/pixelstats/SysfsCollector.h b/pixelstats/include/pixelstats/SysfsCollector.h
index e60842a4..ac8902ad 100644
--- a/pixelstats/include/pixelstats/SysfsCollector.h
+++ b/pixelstats/include/pixelstats/SysfsCollector.h
@@ -73,6 +73,8 @@ class SysfsCollector {
const char *const AmsRatePath;
const std::vector<std::string> ThermalStatsPaths;
const std::vector<std::string> DisplayStatsPaths;
+ const std::vector<std::string> DisplayPortStatsPaths;
+ const std::vector<std::string> HDCPStatsPaths;
const char *const CCARatePath;
const std::vector<std::pair<std::string, std::string>> TempResidencyAndResetPaths;
const char *const LongIRQMetricsPath;
@@ -91,7 +93,7 @@ class SysfsCollector {
const char *const OffloadEffectsIdPath;
const char *const OffloadEffectsDurationPath;
const char *const BluetoothAudioUsagePath;
- const char *const GMSRPath;
+ const std::vector<std::string> GMSRPath;
};
SysfsCollector(const struct SysfsPaths &paths);
@@ -129,6 +131,8 @@ class SysfsCollector {
void logThermalStats(const std::shared_ptr<IStats> &stats_client);
void logMitigationDurationCounts(const std::shared_ptr<IStats> &stats_client);
void logDisplayStats(const std::shared_ptr<IStats> &stats_client);
+ void logDisplayPortStats(const std::shared_ptr<IStats> &stats_client);
+ void logHDCPStats(const std::shared_ptr<IStats> &stats_client);
void logVendorAudioPdmStatsReported(const std::shared_ptr<IStats> &stats_client);
void reportSlowIoFromFile(const std::shared_ptr<IStats> &stats_client, const char *path,
@@ -188,6 +192,8 @@ class SysfsCollector {
const char *const kModemPcieLinkStatsPath;
const char *const kWifiPcieLinkStatsPath;
const std::vector<std::string> kDisplayStatsPaths;
+ const std::vector<std::string> kDisplayPortStatsPaths;
+ const std::vector<std::string> kHDCPStatsPaths;
const char *const kPDMStatePath;
const char *const kWavesPath;
const char *const kAdaptedInfoCountPath;
@@ -198,7 +204,7 @@ class SysfsCollector {
const char *const kOffloadEffectsIdPath;
const char *const kOffloadEffectsDurationPath;
const char *const kBluetoothAudioUsagePath;
- const char *const kGMSRPath;
+ const std::vector<std::string> kGMSRPath;
const char *const kMaxfgHistoryPath;
BatteryEEPROMReporter battery_EEPROM_reporter_;
diff --git a/pixelstats/include/pixelstats/UeventListener.h b/pixelstats/include/pixelstats/UeventListener.h
index 6e6f8174..7d2538e6 100644
--- a/pixelstats/include/pixelstats/UeventListener.h
+++ b/pixelstats/include/pixelstats/UeventListener.h
@@ -21,6 +21,7 @@
#include <android-base/chrono_utils.h>
#include <pixelstats/BatteryCapacityReporter.h>
#include <pixelstats/ChargeStatsReporter.h>
+#include <pixelstats/BatteryFGReporter.h>
namespace android {
namespace hardware {
@@ -46,7 +47,9 @@ class UeventListener {
const char *const TypeCPartnerPidPath;
const char *const WirelessChargerPtmcUevent; // Deprecated.
const char *const WirelessChargerPtmcPath; // Deprecated.
- const char *const GMSRPath;
+ const std::vector<std::string> FGLearningPath;
+ const char *const FwUpdatePath;
+ const std::vector<std::string> FGModelLoadingPath;
};
constexpr static const char *const ssoc_details_path =
"/sys/class/power_supply/battery/ssoc_details";
@@ -59,13 +62,15 @@ class UeventListener {
constexpr static const char *const typec_partner_pid_path_default =
"/sys/class/typec/port0-partner/identity/product";
constexpr static const char *const typec_partner_uevent_default = "DEVTYPE=typec_partner";
- constexpr static const char *const gmsr_path = "";
UeventListener(const std::string audio_uevent, const std::string ssoc_details_path = "",
const std::string overheat_path = overheat_path_default,
const std::string charge_metrics_path = charge_metrics_path_default,
const std::string typec_partner_vid_path = typec_partner_vid_path_default,
- const std::string typec_partner_pid_path = typec_partner_pid_path_default);
+ const std::string typec_partner_pid_path = typec_partner_pid_path_default,
+ const std::vector<std::string> fg_learning_path = { "" },
+ const std::string fw_update_path = "",
+ const std::vector<std::string> fg_modelloading_path = { "" });
UeventListener(const struct UeventPaths &paths);
bool ProcessUevent(); // Process a single Uevent.
@@ -94,6 +99,8 @@ class UeventListener {
void ReportThermalAbnormalEvent(const std::shared_ptr<IStats> &stats_client,
const char *devpath, const char *thermal_abnormal_event_type,
const char *thermal_abnormal_event_info);
+ void ReportFGMetricsEvent(const std::shared_ptr<IStats> &stats_client, const char *driver);
+
const std::string kAudioUevent;
const std::string kBatterySSOCPath;
const std::string kUsbPortOverheatPath;
@@ -101,7 +108,10 @@ class UeventListener {
const std::string kTypeCPartnerUevent;
const std::string kTypeCPartnerVidPath;
const std::string kTypeCPartnerPidPath;
- const std::string kBatteryGMSRPath;
+ const std::vector<std::string> kFGLearningPath;
+ const std::string kFwUpdatePath;
+ const std::vector<std::string> kFGModelLoadingPath;
+
const std::unordered_map<std::string, PixelAtoms::GpuEvent::GpuEventType>
kGpuEventTypeStrToEnum{
@@ -142,7 +152,24 @@ class UeventListener {
{"CSF_RESET_OK",
PixelAtoms::GpuEvent::GpuEventInfo::GpuEvent_GpuEventInfo_MALI_CSF_RESET_OK},
{"CSF_RESET_FAILED", PixelAtoms::GpuEvent::GpuEventInfo::
- GpuEvent_GpuEventInfo_MALI_CSF_RESET_FAILED}};
+ GpuEvent_GpuEventInfo_MALI_CSF_RESET_FAILED},
+ {"TILER_OOM",
+ PixelAtoms::GpuEvent::GpuEventInfo::GpuEvent_GpuEventInfo_MALI_TILER_OOM},
+ {"PROGRESS_TIMER",
+ PixelAtoms::GpuEvent::GpuEventInfo::GpuEvent_GpuEventInfo_MALI_PROGRESS_TIMER},
+ {"CS_ERROR",
+ PixelAtoms::GpuEvent::GpuEventInfo::GpuEvent_GpuEventInfo_MALI_CS_ERROR},
+ {"FW_ERROR",
+ PixelAtoms::GpuEvent::GpuEventInfo::GpuEvent_GpuEventInfo_MALI_FW_ERROR},
+ {"PMODE_EXIT_TIMEOUT", PixelAtoms::GpuEvent::GpuEventInfo::
+ GpuEvent_GpuEventInfo_MALI_PMODE_EXIT_TIMEOUT},
+ {"PMODE_ENTRY_FAILURE", PixelAtoms::GpuEvent::GpuEventInfo::
+ GpuEvent_GpuEventInfo_MALI_PMODE_ENTRY_FAILURE},
+ {"GPU_PAGE_FAULT",
+ PixelAtoms::GpuEvent::GpuEventInfo::GpuEvent_GpuEventInfo_MALI_GPU_PAGE_FAULT},
+ {"MMU_AS_ACTIVE_STUCK",
+ PixelAtoms::GpuEvent::GpuEventInfo::
+ GpuEvent_GpuEventInfo_MALI_MMU_AS_ACTIVE_STUCK}};
const std::unordered_map<std::string,
PixelAtoms::ThermalSensorAbnormalityDetected::AbnormalityType>
@@ -168,6 +195,7 @@ class UeventListener {
BatteryCapacityReporter battery_capacity_reporter_;
ChargeStatsReporter charge_stats_reporter_;
+ BatteryFGReporter battery_fg_reporter_;
// Proto messages are 1-indexed and VendorAtom field numbers start at 2, so
// store everything in the values array at the index of the field number