diff options
author | Jaegeuk Kim <jaegeuk@google.com> | 2020-07-28 10:44:57 -0700 |
---|---|---|
committer | Jaegeuk Kim <jaegeuk@google.com> | 2020-07-28 15:38:09 -0700 |
commit | c925ddf9598f2dfe1ed3e1fb6d65ee8a0be65ae6 (patch) | |
tree | ed79f7ca5c3708aeae7e46863b85bc6ab35fa059 /dumpstate | |
parent | aa05811ec06652c7c791fc865a7b0b084e35d526 (diff) | |
download | bramble-c925ddf9598f2dfe1ed3e1fb6d65ee8a0be65ae6.tar.gz |
dumpstate: use generic sysfs path for storage
Bug: 161925472
Signed-off-by: Jaegeuk Kim <jaegeuk@google.com>
Change-Id: I8b16142d36d2ceedf8b80e5be47a1c325ffd1809
Diffstat (limited to 'dumpstate')
-rwxr-xr-x | dumpstate/DumpstateDevice.cpp | 91 |
1 files changed, 43 insertions, 48 deletions
diff --git a/dumpstate/DumpstateDevice.cpp b/dumpstate/DumpstateDevice.cpp index e319993..2ad505b 100755 --- a/dumpstate/DumpstateDevice.cpp +++ b/dumpstate/DumpstateDevice.cpp @@ -45,8 +45,6 @@ #define DIAG_MDLOG_NUMBER_BUGREPORT "persist.vendor.sys.modem.diag.mdlog_br_num" -#define UFS_BOOTDEVICE "ro.boot.bootdevice" - #define TCPDUMP_NUMBER_BUGREPORT "persist.vendor.tcpdump.log.br_num" #define TCPDUMP_PERSIST_PROPERTY "persist.vendor.tcpdump.log.alwayson" @@ -517,52 +515,49 @@ static void DumpUFS(int fd) { DumpFileToFd(fd, "UFS rev", "/sys/block/sda/device/rev"); DumpFileToFd(fd, "UFS size", "/sys/block/sda/size"); - std::string bootdev = android::base::GetProperty(UFS_BOOTDEVICE, ""); - if (!bootdev.empty()) { - DumpFileToFd(fd, "UFS Slow IO Read", "/sys/devices/platform/soc/" + bootdev + "/slowio_read_cnt"); - DumpFileToFd(fd, "UFS Slow IO Write", "/sys/devices/platform/soc/" + bootdev + "/slowio_write_cnt"); - DumpFileToFd(fd, "UFS Slow IO Unmap", "/sys/devices/platform/soc/" + bootdev + "/slowio_unmap_cnt"); - DumpFileToFd(fd, "UFS Slow IO Sync", "/sys/devices/platform/soc/" + bootdev + "/slowio_sync_cnt"); - - RunCommandToFd(fd, "UFS err_stats", {"/vendor/bin/sh", "-c", - "path=\"/sys/devices/platform/soc/" + bootdev + "/err_stats\"; " - "for node in `ls $path/err_*`; do " - "printf \"%s:%d\\n\" $(basename $node) $(cat $node); done;"}); - - RunCommandToFd(fd, "UFS io_stats", {"/vendor/bin/sh", "-c", - "path=\"/sys/devices/platform/soc/" + bootdev + "/io_stats\"; " - "printf \"\\t\\t%-10s %-10s %-10s %-10s %-10s %-10s\\n\" " - "ReadCnt ReadBytes WriteCnt WriteBytes RWCnt RWBytes; " - "str=$(cat $path/*_start); arr=($str); " - "printf \"Started: \\t%-10s %-10s %-10s %-10s %-10s %-10s\\n\" " - "${arr[1]} ${arr[0]} ${arr[5]} ${arr[4]} ${arr[3]} ${arr[2]}; " - "str=$(cat $path/*_complete); arr=($str); " - "printf \"Completed: \\t%-10s %-10s %-10s %-10s %-10s %-10s\\n\" " - "${arr[1]} ${arr[0]} ${arr[5]} ${arr[4]} ${arr[3]} ${arr[2]}; " - "str=$(cat $path/*_maxdiff); arr=($str); " - "printf \"MaxDiff: \\t%-10s %-10s %-10s %-10s %-10s %-10s\\n\\n\" " - "${arr[1]} ${arr[0]} ${arr[5]} ${arr[4]} ${arr[3]} ${arr[2]}; "}); - - RunCommandToFd(fd, "UFS req_stats", {"/vendor/bin/sh", "-c", - "path=\"/sys/devices/platform/soc/" + bootdev + "/req_stats\"; " - "printf \"\\t%-10s %-10s %-10s %-10s %-10s %-10s %-10s\\n\" " - "All Write Read Read\\(urg\\) Write\\(urg\\) Flush Discard; " - "str=$(cat $path/*_min); arr=($str); " - "printf \"Min:\\t%-10s %-10s %-10s %-10s %-10s %-10s %-10s\\n\" " - "${arr[0]} ${arr[3]} ${arr[6]} ${arr[4]} ${arr[5]} ${arr[2]} ${arr[1]}; " - "str=$(cat $path/*_max); arr=($str); " - "printf \"Max:\\t%-10s %-10s %-10s %-10s %-10s %-10s %-10s\\n\" " - "${arr[0]} ${arr[3]} ${arr[6]} ${arr[4]} ${arr[5]} ${arr[2]} ${arr[1]}; " - "str=$(cat $path/*_avg); arr=($str); " - "printf \"Avg.:\\t%-10s %-10s %-10s %-10s %-10s %-10s %-10s\\n\" " - "${arr[0]} ${arr[3]} ${arr[6]} ${arr[4]} ${arr[5]} ${arr[2]} ${arr[1]}; " - "str=$(cat $path/*_sum); arr=($str); " - "printf \"Count:\\t%-10s %-10s %-10s %-10s %-10s %-10s %-10s\\n\\n\" " - "${arr[0]} ${arr[3]} ${arr[6]} ${arr[4]} ${arr[5]} ${arr[2]} ${arr[1]};"}); - - std::string ufs_health = "for f in $(find /sys/devices/platform/soc/" + bootdev + "/health_descriptor -type f); do if [[ -r $f && -f $f ]]; then echo --- $f; cat $f; echo ''; fi; done"; - RunCommandToFd(fd, "UFS health", {"/vendor/bin/sh", "-c", ufs_health.c_str()}); - } + DumpFileToFd(fd, "UFS Slow IO Read", "/dev/sys/block/bootdevice/slowio_read_cnt"); + DumpFileToFd(fd, "UFS Slow IO Write", "/dev/sys/block/bootdevice/slowio_write_cnt"); + DumpFileToFd(fd, "UFS Slow IO Unmap", "/dev/sys/block/bootdevice/slowio_unmap_cnt"); + DumpFileToFd(fd, "UFS Slow IO Sync", "//dev/sys/block/bootdevice/slowio_sync_cnt"); + + RunCommandToFd(fd, "UFS err_stats", {"/vendor/bin/sh", "-c", + "path=\"/dev/sys/block/bootdevice/err_stats\"; " + "for node in `ls $path/err_*`; do " + "printf \"%s:%d\\n\" $(basename $node) $(cat $node); done;"}); + + RunCommandToFd(fd, "UFS io_stats", {"/vendor/bin/sh", "-c", + "path=\"/dev/sys/block/bootdevice/io_stats\"; " + "printf \"\\t\\t%-10s %-10s %-10s %-10s %-10s %-10s\\n\" " + "ReadCnt ReadBytes WriteCnt WriteBytes RWCnt RWBytes; " + "str=$(cat $path/*_start); arr=($str); " + "printf \"Started: \\t%-10s %-10s %-10s %-10s %-10s %-10s\\n\" " + "${arr[1]} ${arr[0]} ${arr[5]} ${arr[4]} ${arr[3]} ${arr[2]}; " + "str=$(cat $path/*_complete); arr=($str); " + "printf \"Completed: \\t%-10s %-10s %-10s %-10s %-10s %-10s\\n\" " + "${arr[1]} ${arr[0]} ${arr[5]} ${arr[4]} ${arr[3]} ${arr[2]}; " + "str=$(cat $path/*_maxdiff); arr=($str); " + "printf \"MaxDiff: \\t%-10s %-10s %-10s %-10s %-10s %-10s\\n\\n\" " + "${arr[1]} ${arr[0]} ${arr[5]} ${arr[4]} ${arr[3]} ${arr[2]}; "}); + + RunCommandToFd(fd, "UFS req_stats", {"/vendor/bin/sh", "-c", + "path=\"/dev/sys/block/bootdevice/req_stats\"; " + "printf \"\\t%-10s %-10s %-10s %-10s %-10s %-10s %-10s\\n\" " + "All Write Read Read\\(urg\\) Write\\(urg\\) Flush Discard; " + "str=$(cat $path/*_min); arr=($str); " + "printf \"Min:\\t%-10s %-10s %-10s %-10s %-10s %-10s %-10s\\n\" " + "${arr[0]} ${arr[3]} ${arr[6]} ${arr[4]} ${arr[5]} ${arr[2]} ${arr[1]}; " + "str=$(cat $path/*_max); arr=($str); " + "printf \"Max:\\t%-10s %-10s %-10s %-10s %-10s %-10s %-10s\\n\" " + "${arr[0]} ${arr[3]} ${arr[6]} ${arr[4]} ${arr[5]} ${arr[2]} ${arr[1]}; " + "str=$(cat $path/*_avg); arr=($str); " + "printf \"Avg.:\\t%-10s %-10s %-10s %-10s %-10s %-10s %-10s\\n\" " + "${arr[0]} ${arr[3]} ${arr[6]} ${arr[4]} ${arr[5]} ${arr[2]} ${arr[1]}; " + "str=$(cat $path/*_sum); arr=($str); " + "printf \"Count:\\t%-10s %-10s %-10s %-10s %-10s %-10s %-10s\\n\\n\" " + "${arr[0]} ${arr[3]} ${arr[6]} ${arr[4]} ${arr[5]} ${arr[2]} ${arr[1]};"}); + + std::string ufs_health = "for f in $(find /dev/sys/block/bootdevice/health_descriptor -type f); do if [[ -r $f && -f $f ]]; then echo --- $f; cat $f; echo ''; fi; done"; + RunCommandToFd(fd, "UFS health", {"/vendor/bin/sh", "-c", ufs_health.c_str()}); } // Methods from ::android::hardware::dumpstate::V1_0::IDumpstateDevice follow. |