Fix UidMap proto output error. And fix a bug in MaxDurationTracker.
Bug: 76118312
Bug: 76145379
Test: adb shell cmd stats dump-report
statsd_test
Change-Id: I9a987525df5b37fcefd5f28700bfa1c3952f6692
This commit is contained in:
@@ -205,11 +205,12 @@ bool MaxDurationTracker::flushCurrentBucket(
|
||||
bool hasPendingEvent =
|
||||
false; // has either a kStarted or kPaused event across bucket boundaries
|
||||
// meaning we need to carry them over to the new bucket.
|
||||
for (auto it = mInfos.begin(); it != mInfos.end(); ++it) {
|
||||
for (auto it = mInfos.begin(); it != mInfos.end();) {
|
||||
if (it->second.state == DurationState::kStopped) {
|
||||
// No need to keep buckets for events that were stopped before.
|
||||
mInfos.erase(it);
|
||||
it = mInfos.erase(it);
|
||||
} else {
|
||||
++it;
|
||||
hasPendingEvent = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -365,7 +365,8 @@ void UidMap::appendUidMap(const int64_t& timestamp, const ConfigKey& key,
|
||||
count++;
|
||||
proto->write(FIELD_TYPE_INT64 | FIELD_ID_SNAPSHOT_TIMESTAMP,
|
||||
(long long)record.timestampNs);
|
||||
proto->write(FIELD_TYPE_MESSAGE | FIELD_ID_SNAPSHOT_PACKAGE_INFO, record.bytes.data());
|
||||
proto->write(FIELD_TYPE_MESSAGE | FIELD_ID_SNAPSHOT_PACKAGE_INFO, record.bytes.data(),
|
||||
record.bytes.size());
|
||||
proto->end(snapshotsToken);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user