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

Commit e6472fe5 authored by Android Merger's avatar Android Merger Committed by Gerrit Code Review
Browse files

Merge "Snap for 5180536 from eb71e821 to...

Merge "Snap for 5180536 from eb71e821 to pi-platform-release am: 04898ff5" into pie-gsi
parents d3ecd466 3affd5dc
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
@@ -71,6 +71,9 @@ const int FIELD_ID_STRINGS = 9;

#define STATS_DATA_DIR "/data/misc/stats-data"

// Cool down period for writing data to disk to avoid overwriting files.
#define WRITE_DATA_COOL_DOWN_SEC 5

StatsLogProcessor::StatsLogProcessor(const sp<UidMap>& uidMap,
                                     const sp<AlarmMonitor>& anomalyAlarmMonitor,
                                     const sp<AlarmMonitor>& periodicAlarmMonitor,
@@ -526,6 +529,16 @@ void StatsLogProcessor::WriteDataToDiskLocked(const ConfigKey& key,

void StatsLogProcessor::WriteDataToDiskLocked(const DumpReportReason dumpReportReason) {
    const int64_t timeNs = getElapsedRealtimeNs();
    // Do not write to disk if we already have in the last few seconds.
    // This is to avoid overwriting files that would have the same name if we
    //   write twice in the same second.
    if (static_cast<unsigned long long> (timeNs) <
            mLastWriteTimeNs + WRITE_DATA_COOL_DOWN_SEC * NS_PER_SEC) {
        ALOGI("Statsd skipping writing data to disk. Already wrote data in last %d seconds",
                WRITE_DATA_COOL_DOWN_SEC);
        return;
    }
    mLastWriteTimeNs = timeNs;
    for (auto& pair : mMetricsManagers) {
        WriteDataToDiskLocked(pair.first, timeNs, dumpReportReason);
    }
+5 −1
Original line number Diff line number Diff line
@@ -40,7 +40,8 @@ enum DumpReportReason {
    GET_DATA_CALLED = 4,
    ADB_DUMP = 5,
    CONFIG_RESET = 6,
    STATSCOMPANION_DIED = 7
    STATSCOMPANION_DIED = 7,
    TERMINATION_SIGNAL_RECEIVED = 8
};

class StatsLogProcessor : public ConfigListener {
@@ -183,6 +184,9 @@ private:

    long mLastPullerCacheClearTimeSec = 0;

    // Last time we wrote data to disk.
    int64_t mLastWriteTimeNs = 0;

#ifdef VERY_VERBOSE_PRINTING
    bool mPrintAllLogs = false;
#endif
+7 −0
Original line number Diff line number Diff line
@@ -881,6 +881,13 @@ void StatsService::Startup() {
    mConfigManager->Startup();
}

void StatsService::Terminate() {
    ALOGI("StatsService::Terminating");
    if (mProcessor != nullptr) {
        mProcessor->WriteDataToDisk(TERMINATION_SIGNAL_RECEIVED);
    }
}

void StatsService::OnLogEvent(LogEvent* event, bool reconnectionStarts) {
    mProcessor->OnLogEvent(event, reconnectionStarts);
}
+5 −0
Original line number Diff line number Diff line
@@ -73,6 +73,11 @@ public:
     */
    void Startup();

    /**
     * Called when terminiation signal received.
     */
    void Terminate();

    /**
     * Called by LogReader when there's a log event to process.
     */
+21 −2
Original line number Diff line number Diff line
@@ -121,8 +121,7 @@ message Atom {
        ANROccurred anr_occurred = 79;
        WTFOccurred wtf_occurred = 80;
        LowMemReported low_mem_reported = 81;


        ThermalThrottlingStateChanged thermal_throttling = 86;
    }

    // Pulled events will start at field 10000.
@@ -197,6 +196,26 @@ message AttributionNode {
 * *****************************************************************************
 */

/**
 * Logs when the Thermal service HAL notifies the throttling start/stop events.
 *
 * Logged from:
 *   frameworks/base/services/core/java/com/android/server/stats/StatsCompanionService.java
 */
message ThermalThrottlingStateChanged {
    optional android.os.TemperatureTypeEnum sensor_type = 1;

    enum State {
        UNKNOWN = 0;
        START = 1;
        STOP = 2;
    }

    optional State state = 2;

    optional float temperature = 3;
}

/**
 * Logs when the screen state changes.
 *
Loading