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

Commit aec9c3e4 authored by Andy Hung's avatar Andy Hung Committed by Android (Google) Code Review
Browse files

Merge "AudioFlinger: Add Thread history to dumpsys"

parents 0d97cec0 a8115dc6
Loading
Loading
Loading
Loading
+17 −0
Original line number Diff line number Diff line
@@ -56,6 +56,7 @@
#include <system/audio_effects/effect_ns.h>
#include <system/audio_effects/effect_aec.h>

#include <audio_utils/FdToString.h>
#include <audio_utils/primitives.h>

#include <json/json.h>
@@ -525,6 +526,12 @@ status_t AudioFlinger::dump(int fd, const Vector<String16>& args)
        dumpLogger(mAppSetParameterLog, "App");
        dumpLogger(mSystemSetParameterLog, "System");

        // dump historical threads in the last 10 seconds
        const std::string threadLog = mThreadLog.dumpToString(
                "Historical Thread Log ", 0 /* lines */,
                audio_utils_get_real_time_ns() - 10 * 60 * NANOS_PER_SECOND);
        write(fd, threadLog.c_str(), threadLog.size());

        BUFLOG_RESET;

        if (locked) {
@@ -2291,6 +2298,16 @@ status_t AudioFlinger::closeOutput_nonvirtual(audio_io_handle_t output)
        if (playbackThread != NULL) {
            ALOGV("closeOutput() %d", output);

            {
                // Dump thread before deleting for history
                audio_utils::FdToString fdToString;
                const int fd = fdToString.fd();
                if (fd >= 0) {
                    playbackThread->dump(fd, {} /* args */);
                    mThreadLog.logs(-1 /* time */, fdToString.getStringAndClose());
                }
            }

            if (playbackThread->type() == ThreadBase::MIXER) {
                for (size_t i = 0; i < mPlaybackThreads.size(); i++) {
                    if (mPlaybackThreads.valueAt(i)->isDuplicating()) {
+2 −0
Original line number Diff line number Diff line
@@ -426,6 +426,8 @@ private:
    void dumpClients(int fd, const Vector<String16>& args);
    void dumpInternals(int fd, const Vector<String16>& args);

    SimpleLog mThreadLog{10}; // 10 Thread history limit

    // --- Client ---
    class Client : public RefBase {
    public: