Merge "Skip writing metrics to disk if it's entirely composed of no_report_metric" into pi-dev

This commit is contained in:
TreeHugger Robot 2018-05-10 02:02:37 +00:00 committed by Android (Google) Code Review
commit 3f57b16deb
2 changed files with 6 additions and 1 deletions

View File

@ -503,7 +503,8 @@ void StatsLogProcessor::flushIfNecessaryLocked(
void StatsLogProcessor::WriteDataToDiskLocked(const ConfigKey& key,
const int64_t timestampNs,
const DumpReportReason dumpReportReason) {
if (mMetricsManagers.find(key) == mMetricsManagers.end()) {
if (mMetricsManagers.find(key) == mMetricsManagers.end() ||
!mMetricsManagers.find(key)->second->shouldWriteToDisk()) {
return;
}
ProtoOutputStream proto;

View File

@ -67,6 +67,10 @@ public:
return !mAllowedPkg.empty();
}
bool shouldWriteToDisk() const {
return mNoReportMetricIds.size() != mAllMetricProducers.size();
}
void dumpStates(FILE* out, bool verbose);
inline bool isInTtl(const int64_t timestampNs) const {