diff options
author | 2021-05-04 04:56:04 +0000 | |
---|---|---|
committer | 2021-05-04 04:56:04 +0000 | |
commit | 30253adb74b1e9e37f4a1286a7762e84d0245bca (patch) | |
tree | ab17a48f10944f4d31134dd3a9811282c2e05a42 /services/incremental/IncrementalService.cpp | |
parent | d8f57c7cf37298beb7792629acc88d608dd0b838 (diff) | |
parent | d48a25ee649b9aa2e6dde6e0e9844bb7da8bfe5c (diff) |
Merge "[IncrementalService] add last read error in dumpsys" into sc-dev
Diffstat (limited to 'services/incremental/IncrementalService.cpp')
-rw-r--r-- | services/incremental/IncrementalService.cpp | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/services/incremental/IncrementalService.cpp b/services/incremental/IncrementalService.cpp index 9d47a4e462d2..36c0a677f43a 100644 --- a/services/incremental/IncrementalService.cpp +++ b/services/incremental/IncrementalService.cpp @@ -398,6 +398,15 @@ static long elapsedMcs(Duration start, Duration end) { return std::chrono::duration_cast<std::chrono::microseconds>(end - start).count(); } +static uint64_t elapsedUsSinceMonoTs(uint64_t monoTsUs) { + timespec now; + if (clock_gettime(CLOCK_MONOTONIC, &now) != 0) { + return 0; + } + uint64_t nowUs = now.tv_sec * 1000000LL + now.tv_nsec / 1000; + return nowUs - monoTsUs; +} + void IncrementalService::onDump(int fd) { dprintf(fd, "Incremental is %s\n", incfs::enabled() ? "ENABLED" : "DISABLED"); dprintf(fd, "IncFs features: 0x%x\n", int(mIncFs->features())); @@ -466,6 +475,25 @@ void IncrementalService::onDump(int fd) { dprintf(fd, " Metrics not available. Errno: %d\n", errno); } dprintf(fd, " }\n"); + + const auto lastReadError = mIncFs->getLastReadError(ifs->control); + const auto errorNo = errno; + dprintf(fd, " lastReadError: {\n"); + if (lastReadError) { + if (lastReadError->timestampUs == 0) { + dprintf(fd, " No read errors.\n"); + } else { + dprintf(fd, " fileId: %s\n", + IncFsWrapper::toString(lastReadError->id).c_str()); + dprintf(fd, " time: %llu microseconds ago\n", + (unsigned long long)elapsedUsSinceMonoTs(lastReadError->timestampUs)); + dprintf(fd, " blockIndex: %d\n", lastReadError->block); + dprintf(fd, " errno: %d\n", lastReadError->errorNo); + } + } else { + dprintf(fd, " Info not available. Errno: %d\n", errorNo); + } + dprintf(fd, " }\n"); } dprintf(fd, " }\n"); } |