From e9dd5f3ee6788f0c101bedf1132c7cf22b2f26d3 Mon Sep 17 00:00:00 2001 From: Adam Shih Date: Wed, 28 Sep 2022 13:26:17 +0800 Subject: [PATCH] move UFS dump to gs-common Bug: 248143736 Test: adb bugreport Change-Id: I5574e3629d6ce7196e332ab80de4206669d8094f --- dumpstate/Dumpstate.cpp | 59 ----------------------------------------- dumpstate/Dumpstate.h | 1 - 2 files changed, 60 deletions(-) diff --git a/dumpstate/Dumpstate.cpp b/dumpstate/Dumpstate.cpp index 01aefdd1..feb3ca18 100644 --- a/dumpstate/Dumpstate.cpp +++ b/dumpstate/Dumpstate.cpp @@ -43,8 +43,6 @@ #define GPS_LOG_NUMBER_PROPERTY "persist.vendor.gps.aol.log_num" #define GPS_LOGGING_STATUS_PROPERTY "vendor.gps.aol.enabled" -#define UFS_BOOTDEVICE "ro.boot.bootdevice" - #define TCPDUMP_LOG_DIRECTORY "/data/vendor/tcpdump_logger/logs" #define TCPDUMP_NUMBER_BUGREPORT "persist.vendor.tcpdump.log.br_num" #define TCPDUMP_PERSIST_PROPERTY "persist.vendor.tcpdump.log.alwayson" @@ -226,7 +224,6 @@ Dumpstate::Dumpstate() { "wlan", [this](int fd) { dumpWlanSection(fd); } }, { "modem", [this](int fd) { dumpModemSection(fd); } }, { "soc", [this](int fd) { dumpSocSection(fd); } }, - { "storage", [this](int fd) { dumpStorageSection(fd); } }, { "memory", [this](int fd) { dumpMemorySection(fd); } }, { "Devfreq", [this](int fd) { dumpDevfreqSection(fd); } }, { "cpu", [this](int fd) { dumpCpuSection(fd); } }, @@ -956,62 +953,6 @@ void Dumpstate::dumpMemorySection(int fd) { "done"}); } -static void DumpUFS(int fd) { - DumpFileToFd(fd, "UFS model", "/sys/block/sda/device/model"); - DumpFileToFd(fd, "UFS rev", "/sys/block/sda/device/rev"); - DumpFileToFd(fd, "UFS size", "/sys/block/sda/size"); - - 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/* | grep -v reset_err_status`; 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\\n\" " - "All Write Read Security Flush Discard; " - "str=$(cat $path/*_min); arr=($str); " - "printf \"Min:\\t%-10s %-10s %-10s %-10s %-10s %-10s\\n\" " - "${arr[0]} ${arr[5]} ${arr[3]} ${arr[4]} ${arr[2]} ${arr[1]}; " - "str=$(cat $path/*_max); arr=($str); " - "printf \"Max:\\t%-10s %-10s %-10s %-10s %-10s %-10s\\n\" " - "${arr[0]} ${arr[5]} ${arr[3]} ${arr[4]} ${arr[2]} ${arr[1]}; " - "str=$(cat $path/*_avg); arr=($str); " - "printf \"Avg.:\\t%-10s %-10s %-10s %-10s %-10s %-10s\\n\" " - "${arr[0]} ${arr[5]} ${arr[3]} ${arr[4]} ${arr[2]} ${arr[1]}; " - "str=$(cat $path/*_sum); arr=($str); " - "printf \"Count:\\t%-10s %-10s %-10s %-10s %-10s %-10s\\n\\n\" " - "${arr[0]} ${arr[5]} ${arr[3]} ${arr[4]} ${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()}); -} - -// Dump items related to storage -void Dumpstate::dumpStorageSection(int fd) { - DumpUFS(fd); -} - // Dump items related to display void Dumpstate::dumpDisplaySection(int fd) { DumpFileToFd(fd, "CRTC-0 underrun count", "/sys/kernel/debug/dri/0/crtc-0/underrun_cnt"); diff --git a/dumpstate/Dumpstate.h b/dumpstate/Dumpstate.h index a7f6ad3f..d23d0537 100644 --- a/dumpstate/Dumpstate.h +++ b/dumpstate/Dumpstate.h @@ -61,7 +61,6 @@ class Dumpstate : public BnDumpstateDevice { void dumpCpuSection(int fd); void dumpDevfreqSection(int fd); void dumpMemorySection(int fd); - void dumpStorageSection(int fd); void dumpDisplaySection(int fd); void dumpSensorsUSFSection(int fd); void dumpAoCSection(int fd);