summaryrefslogtreecommitdiff
path: root/services/incremental/IncrementalService.cpp
diff options
context:
space:
mode:
author Songchun Fan <schfan@google.com> 2020-11-06 15:24:24 -0800
committer Songchun Fan <schfan@google.com> 2020-11-09 22:07:54 +0000
commit6944f1e484a86338994a01842e78410866f43211 (patch)
tree19c1c4516342402f083cca320c3c236c9998016a /services/incremental/IncrementalService.cpp
parent012eb24033608632b5eb5f73628da9486c650863 (diff)
[incremental] add last pending reads info in dumpsys
Example section of dumpsys output: lastPendingReads: fileId: 03300000000000000000000000000000 metadataHex: 0330 blockIndex: 857738 bootClockTsUs: 166877488 Test: manual BUG: 162600251 Change-Id: I37b04751c2a11972450ce7e9082116f8047e87df
Diffstat (limited to 'services/incremental/IncrementalService.cpp')
-rw-r--r--services/incremental/IncrementalService.cpp30
1 files changed, 25 insertions, 5 deletions
diff --git a/services/incremental/IncrementalService.cpp b/services/incremental/IncrementalService.cpp
index 599ac9344e73..91478a594ad2 100644
--- a/services/incremental/IncrementalService.cpp
+++ b/services/incremental/IncrementalService.cpp
@@ -2341,17 +2341,16 @@ BootClockTsUs IncrementalService::DataLoaderStub::getOldestPendingReadTs() {
return result;
}
- std::vector<incfs::ReadInfo> pendingReads;
- if (mService.mIncFs->waitForPendingReads(control, 0ms, &pendingReads) !=
+ if (mService.mIncFs->waitForPendingReads(control, 0ms, &mLastPendingReads) !=
android::incfs::WaitResult::HaveData ||
- pendingReads.empty()) {
+ mLastPendingReads.empty()) {
return result;
}
LOG(DEBUG) << id() << ": pendingReads: " << control.pendingReads() << ", "
- << pendingReads.size() << ": " << pendingReads.front().bootClockTsUs;
+ << mLastPendingReads.size() << ": " << mLastPendingReads.front().bootClockTsUs;
- for (auto&& pendingRead : pendingReads) {
+ for (auto&& pendingRead : mLastPendingReads) {
result = std::min(result, pendingRead.bootClockTsUs);
}
return result;
@@ -2400,6 +2399,18 @@ void IncrementalService::DataLoaderStub::setHealthListener(
}
}
+static std::string toHexString(const RawMetadata& metadata) {
+ int n = metadata.size();
+ std::string res(n * 2, '\0');
+ // Same as incfs::toString(fileId)
+ static constexpr char kHexChar[] = "0123456789abcdef";
+ for (int i = 0; i < n; ++i) {
+ res[i * 2] = kHexChar[(metadata[i] & 0xf0) >> 4];
+ res[i * 2 + 1] = kHexChar[(metadata[i] & 0x0f)];
+ }
+ return res;
+}
+
void IncrementalService::DataLoaderStub::onDump(int fd) {
dprintf(fd, " dataLoader: {\n");
dprintf(fd, " currentStatus: %d\n", mCurrentStatus);
@@ -2415,6 +2426,15 @@ void IncrementalService::DataLoaderStub::onDump(int fd) {
dprintf(fd, " unhealthyTimeoutMs: %d\n", int(mHealthCheckParams.unhealthyTimeoutMs));
dprintf(fd, " unhealthyMonitoringMs: %d\n",
int(mHealthCheckParams.unhealthyMonitoringMs));
+ dprintf(fd, " lastPendingReads: \n");
+ const auto control = mService.mIncFs->openMount(mHealthPath);
+ for (auto&& pendingRead : mLastPendingReads) {
+ dprintf(fd, " fileId: %s\n", mService.mIncFs->toString(pendingRead.id).c_str());
+ const auto metadata = mService.mIncFs->getMetadata(control, pendingRead.id);
+ dprintf(fd, " metadataHex: %s\n", toHexString(metadata).c_str());
+ dprintf(fd, " blockIndex: %d\n", pendingRead.block);
+ dprintf(fd, " bootClockTsUs: %lld\n", (long long)pendingRead.bootClockTsUs);
+ }
dprintf(fd, " }\n");
const auto& params = mParams;
dprintf(fd, " dataLoaderParams: {\n");