summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTreeHugger Robot <treehugger-gerrit@google.com>2021-09-14 18:10:18 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2021-09-14 18:10:18 +0000
commit00365e4a9a44918c88c99c77e29da2a2e2e90e47 (patch)
tree0dd2514542495c351a4107de7d577243cb2b43f2
parentb116ed9f92b38782282a9832c3c7c505270c6186 (diff)
parent1f321b5917a6a887398a5a109274bd1364284d70 (diff)
downloadpixel-00365e4a9a44918c88c99c77e29da2a2e2e90e47.tar.gz
Merge "Pixelstats: read other count instead of reset count" into sc-qpr1-dev am: 1f321b5917
Original change: https://googleplex-android-review.googlesource.com/c/platform/hardware/google/pixel/+/15818513 Change-Id: I2870e2eb78b71db2aecc3ac647e783235dd7a21f
-rw-r--r--pixelstats/SysfsCollector.cpp17
-rw-r--r--pixelstats/include/pixelstats/SysfsCollector.h4
2 files changed, 12 insertions, 9 deletions
diff --git a/pixelstats/SysfsCollector.cpp b/pixelstats/SysfsCollector.cpp
index 520a564a..f2fdeea8 100644
--- a/pixelstats/SysfsCollector.cpp
+++ b/pixelstats/SysfsCollector.cpp
@@ -73,7 +73,6 @@ SysfsCollector::SysfsCollector(const struct SysfsPaths &sysfs_paths)
kUFSLifetimeA(sysfs_paths.UFSLifetimeA),
kUFSLifetimeB(sysfs_paths.UFSLifetimeB),
kUFSLifetimeC(sysfs_paths.UFSLifetimeC),
- kUFSHostResetPath(sysfs_paths.UFSHostResetPath),
kF2fsStatsPath(sysfs_paths.F2fsStatsPath),
kZramMmStatPath("/sys/block/zram0/mm_stat"),
kZramBdStatPath("/sys/block/zram0/bd_stat"),
@@ -81,7 +80,8 @@ SysfsCollector::SysfsCollector(const struct SysfsPaths &sysfs_paths)
kPowerMitigationStatsPath(sysfs_paths.MitigationPath),
kSpeakerTemperaturePath(sysfs_paths.SpeakerTemperaturePath),
kSpeakerExcursionPath(sysfs_paths.SpeakerExcursionPath),
- kSpeakerHeartbeatPath(sysfs_paths.SpeakerHeartBeatPath) {}
+ kSpeakerHeartbeatPath(sysfs_paths.SpeakerHeartBeatPath),
+ kUFSErrStatsPath(sysfs_paths.UFSErrStatsPath) {}
bool SysfsCollector::ReadFileToInt(const std::string &path, int *val) {
return ReadFileToInt(path.c_str(), val);
@@ -467,16 +467,19 @@ void SysfsCollector::logUFSLifetime(const std::shared_ptr<IStats> &stats_client)
}
void SysfsCollector::logUFSErrorStats(const std::shared_ptr<IStats> &stats_client) {
- int host_reset_count;
+ int value, host_reset_count = 0;
- if (kUFSHostResetPath == nullptr || strlen(kUFSHostResetPath) == 0) {
+ if (kUFSErrStatsPath.empty() || strlen(kUFSErrStatsPath.front().c_str()) == 0) {
ALOGV("UFS host reset count specified");
return;
}
- if (!ReadFileToInt(kUFSHostResetPath, &host_reset_count)) {
- ALOGE("Unable to read host reset count");
- return;
+ for (int i = 0; i < kUFSErrStatsPath.size(); i++) {
+ if (!ReadFileToInt(kUFSErrStatsPath[i], &value)) {
+ ALOGE("Unable to read host reset count");
+ return;
+ }
+ host_reset_count += value;
}
// Load values array
diff --git a/pixelstats/include/pixelstats/SysfsCollector.h b/pixelstats/include/pixelstats/SysfsCollector.h
index 2dcfea9b..097a4c76 100644
--- a/pixelstats/include/pixelstats/SysfsCollector.h
+++ b/pixelstats/include/pixelstats/SysfsCollector.h
@@ -48,7 +48,6 @@ class SysfsCollector {
const char *const UFSLifetimeA;
const char *const UFSLifetimeB;
const char *const UFSLifetimeC;
- const char *const UFSHostResetPath;
const char *const F2fsStatsPath;
const char *const UserdataBlockProp;
const char *const ZramMmStatPath;
@@ -58,6 +57,7 @@ class SysfsCollector {
const char *const SpeakerTemperaturePath;
const char *const SpeakerExcursionPath;
const char *const SpeakerHeartBeatPath;
+ const std::vector<std::string> UFSErrStatsPath;
};
SysfsCollector(const struct SysfsPaths &paths);
@@ -106,7 +106,6 @@ class SysfsCollector {
const char *const kUFSLifetimeA;
const char *const kUFSLifetimeB;
const char *const kUFSLifetimeC;
- const char *const kUFSHostResetPath;
const char *const kF2fsStatsPath;
const char *const kZramMmStatPath;
const char *const kZramBdStatPath;
@@ -115,6 +114,7 @@ class SysfsCollector {
const char *const kSpeakerTemperaturePath;
const char *const kSpeakerExcursionPath;
const char *const kSpeakerHeartbeatPath;
+ const std::vector<std::string> kUFSErrStatsPath;
BatteryEEPROMReporter battery_EEPROM_reporter_;
MmMetricsReporter mm_metrics_reporter_;