lito: dumpstate: refactor UFS dump

* show the format of req_stats
* show the format of io_stats
* Remove show_hba & err_stats

dumpstate_board:
------ UFS io_stats (/vendor/bin/sh ... ------
		ReadCnt    ReadBytes  WriteCnt   WriteBytes RWCnt      RWBytes
Started: 	28083      2026180608 6217       102711296  34300      2128891904
Completed: 	28083      2026180608 6217       102711296  34300      2128891904
MaxDiff: 	32         1855488    32         5419008    32         5861376
------ UFS req_stats (/vendor/bin/sh -c ... ------
	All        Write      Read       Read(urg)  Write(urg) Flush      Discard
Min:	27         29         27         0          47         49         402
Max:	82030      12480      37678      0          82030      3751       523
Avg.:	719        654        640        0          6383       429        468
Count:	26821579   20109241   3762901    0          2853377    92778      3282

Bug: 137150088
Test: run bugreport and capture dumpstate_board
Change-Id: I519d4d751028e127abffcd0230d0e7664aa13386
Signed-off-by: Leo Liou <leoliou@google.com>
This commit is contained in:
Leo Liou
2019-11-04 00:18:48 +08:00
parent 56da68dbfb
commit 41c0c58f43

View File

@@ -346,10 +346,36 @@ static void DumpF2FS(int fd) {
static void DumpUFS(int fd) {
DumpFileToFd(fd, "UFS vendor info", "/proc/scsi/scsi");
DumpFileToFd(fd, "UFS show_hba", "/sys/kernel/debug/ufshcd0/show_hba");
DumpFileToFd(fd, "UFS err_stats", "/sys/kernel/debug/ufshcd0/stats/err_stats");
DumpFileToFd(fd, "UFS io_stats", "/sys/kernel/debug/ufshcd0/stats/io_stats");
DumpFileToFd(fd, "UFS req_stats", "/sys/kernel/debug/ufshcd0/stats/req_stats");
RunCommandToFd(fd, "UFS io_stats", {"/vendor/bin/sh", "-c",
"path=\"/sys/devices/platform/soc/*ufshc*/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/*ufshc*/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 bootdev = android::base::GetProperty(UFS_BOOTDEVICE, "");
if (!bootdev.empty()) {