Merge "Move cookie tag bpf map dump to NetworkStatsService"

This commit is contained in:
Motomu Utsumi
2022-08-03 07:43:13 +00:00
committed by Gerrit Code Review
4 changed files with 87 additions and 18 deletions

View File

@@ -612,8 +612,6 @@ void TrafficController::dump(int fd, bool verbose) {
ScopedIndent indentPreBpfModule(dw);
dw.blankline();
dw.println("mCookieTagMap status: %s",
getMapStatus(mCookieTagMap.getMap(), COOKIE_TAG_MAP_PATH).c_str());
dw.println("mUidCounterSetMap status: %s",
getMapStatus(mUidCounterSetMap.getMap(), UID_COUNTERSET_MAP_PATH).c_str());
dw.println("mAppUidStatsMap status: %s",
@@ -653,18 +651,6 @@ void TrafficController::dump(int fd, bool verbose) {
ScopedIndent indentForMapContent(dw);
// Print CookieTagMap content.
dumpBpfMap("mCookieTagMap", dw, "");
const auto printCookieTagInfo = [&dw](const uint64_t& key, const UidTagValue& value,
const BpfMap<uint64_t, UidTagValue>&) {
dw.println("cookie=%" PRIu64 " tag=0x%x uid=%u", key, value.tag, value.uid);
return base::Result<void>();
};
base::Result<void> res = mCookieTagMap.iterateWithValue(printCookieTagInfo);
if (!res.ok()) {
dw.println("mCookieTagMap print end with error: %s", res.error().message().c_str());
}
// Print UidCounterSetMap content.
dumpBpfMap("mUidCounterSetMap", dw, "");
const auto printUidInfo = [&dw](const uint32_t& key, const uint8_t& value,
@@ -672,7 +658,7 @@ void TrafficController::dump(int fd, bool verbose) {
dw.println("%u %u", key, value);
return base::Result<void>();
};
res = mUidCounterSetMap.iterateWithValue(printUidInfo);
base::Result<void> res = mUidCounterSetMap.iterateWithValue(printUidInfo);
if (!res.ok()) {
dw.println("mUidCounterSetMap print end with error: %s", res.error().message().c_str());
}