Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 028091cb authored by yro's avatar yro
Browse files

Skip writing metrics to disk if it's entirely composed of

no_report_metric

Test: unit test, cts
Bug: 79488249
Change-Id: I3e13a6271cc36665a43d0f09d8663e5996224477
parent 414be0b1
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -500,7 +500,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;
+4 −0
Original line number Diff line number Diff line
@@ -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 {