diff options
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"); } |