Bug:
76118312
Bug:
76145379
Test: adb shell cmd stats dump-report
statsd_test
Change-Id: I9a987525df5b37fcefd5f28700bfa1c3952f6692
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;
}
}
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);
}
}