Merge "AudioFlinger: Add Thread history to dumpsys"

gugelfrei
Andy Hung 6 years ago committed by Android (Google) Code Review
commit aec9c3e4b5

@ -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()) {

@ -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:

Loading…
Cancel
Save