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

Commit b8fd1e90 authored by Carter Hsu's avatar Carter Hsu
Browse files

statsd: implement Speech DSP stat report



Bug: 122719904
Test: manual stats_client test and check the statsd logs
Change-Id: I3dac9f31f59e6f10393c97c6bd9ca0d0ccb11e23
Signed-off-by: default avatarCarter Hsu <carterhsu@google.com>
parent e2c3e477
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -1097,6 +1097,14 @@ hardware::Return<void> StatsService::reportUsbPortOverheatEvent(
    return hardware::Void();
}

hardware::Return<void> StatsService::reportSpeechDspStat(
        const SpeechDspStat& speechDspStat) {
    LogEvent event(getWallClockSec() * NS_PER_SEC, getElapsedRealtimeNs(), speechDspStat);
    mProcessor->OnLogEvent(&event);

    return hardware::Void();
}

void StatsService::binderDied(const wp <IBinder>& who) {
    ALOGW("statscompanion service died");
    StatsdStats::getInstance().noteSystemServerRestart(getWallClockSec());
+6 −0
Original line number Diff line number Diff line
@@ -205,6 +205,12 @@ public:
    virtual Return<void> reportUsbPortOverheatEvent(
            const UsbPortOverheatEvent& usbPortOverheatEvent) override;

    /**
     * Binder call to get Speech DSP state atom.
     */
    virtual Return<void> reportSpeechDspStat(
            const SpeechDspStat& speechDspStat) override;

    /** IBinder::DeathRecipient */
    virtual void binderDied(const wp<IBinder>& who) override;

+16 −0
Original line number Diff line number Diff line
@@ -206,6 +206,7 @@ message Atom {
        BroadcastDispatchLatencyReported broadcast_dispatch_latency_reported = 142;
        AttentionManagerServiceResultReported attention_manager_service_result_reported = 143;
        AdbConnectionChanged adb_connection_changed = 144;
        SpeechDspStatReported speech_dsp_stat_reported = 145;
    }

    // Pulled events will start at field 10000.
@@ -4521,3 +4522,18 @@ message AdbConnectionChanged {
    // True if the 'always allow' option was selected for this system.
    optional bool always_allow = 4;
}

/*
 * Logs the reported speech DSP status.
 *
 * Logged from:
 *  Vendor audio implementation.
 */
message SpeechDspStatReported {
    // The total Speech DSP uptime in milliseconds.
    optional int32 total_uptime_millis = 1;
    // The total Speech DSP downtime in milliseconds.
    optional int32 total_downtime_millis = 2;
    optional int32 total_crash_count = 3;
    optional int32 total_recover_count = 4;
}
+16 −0
Original line number Diff line number Diff line
@@ -266,6 +266,22 @@ LogEvent::LogEvent(int64_t wallClockTimestampNs, int64_t elapsedTimestampNs, con
    mValues.push_back(FieldValue(Field(mTagId, getSimpleField(2)), Value(slowIo.count)));
}

LogEvent::LogEvent(int64_t wallClockTimestampNs, int64_t elapsedTimestampNs,
                   const SpeechDspStat& speechDspStat) {
    mLogdTimestampNs = wallClockTimestampNs;
    mElapsedTimestampNs = elapsedTimestampNs;
    mTagId = android::util::SPEECH_DSP_STAT_REPORTED;

    mValues.push_back(FieldValue(Field(mTagId, getSimpleField(1)),
                                 Value(speechDspStat.totalUptimeMillis)));
    mValues.push_back(FieldValue(Field(mTagId, getSimpleField(2)),
                                 Value(speechDspStat.totalDowntimeMillis)));
    mValues.push_back(FieldValue(Field(mTagId, getSimpleField(3)),
                                 Value(speechDspStat.totalCrashCount)));
    mValues.push_back(FieldValue(Field(mTagId, getSimpleField(4)),
                                 Value(speechDspStat.totalRecoverCount)));
}

LogEvent::LogEvent(int64_t wallClockTimestampNs, int64_t elapsedTimestampNs,
                   const BatteryCausedShutdown& batteryCausedShutdown) {
    mLogdTimestampNs = wallClockTimestampNs;
+3 −0
Original line number Diff line number Diff line
@@ -121,6 +121,9 @@ public:
    explicit LogEvent(int64_t wallClockTimestampNs, int64_t elapsedTimestampNs,
                      const UsbPortOverheatEvent& usbPortOverheatEvent);

    explicit LogEvent(int64_t wallClockTimestampNs, int64_t elapsedTimestampNs,
                      const SpeechDspStat& speechDspStat);

    ~LogEvent();

    /**