diff --git a/power-libperfmgr/Power.cpp b/power-libperfmgr/Power.cpp index 6e7931a..ca36b16 100644 --- a/power-libperfmgr/Power.cpp +++ b/power-libperfmgr/Power.cpp @@ -188,6 +188,7 @@ binder_status_t Power::dump(int fd, const char **, uint32_t) { boolToString(mSustainedPerfModeOn))); // Dump nodes through libperfmgr HintManager::GetInstance()->DumpToFd(fd); + PowerSessionManager::getInstance()->dumpToFd(fd); if (!::android::base::WriteStringToFd(buf, fd)) { PLOG(ERROR) << "Failed to dump state to fd"; } diff --git a/power-libperfmgr/PowerHintSession.cpp b/power-libperfmgr/PowerHintSession.cpp index 32de767..0507096 100644 --- a/power-libperfmgr/PowerHintSession.cpp +++ b/power-libperfmgr/PowerHintSession.cpp @@ -200,6 +200,13 @@ int PowerHintSession::getUclampMin() { return mDescriptor->current_min; } +void PowerHintSession::dumpToStream(std::ostream &stream) { + stream << "ID.Min.Act.Stale(" << getIdString(); + stream << ", " << mDescriptor->current_min; + stream << ", " << mDescriptor->is_active; + stream << ", " << isStale() << ")"; +} + ndk::ScopedAStatus PowerHintSession::pause() { if (mSessionClosed) { ALOGE("Error: session is dead"); diff --git a/power-libperfmgr/PowerHintSession.h b/power-libperfmgr/PowerHintSession.h index bf4280f..203cfbb 100644 --- a/power-libperfmgr/PowerHintSession.h +++ b/power-libperfmgr/PowerHintSession.h @@ -90,6 +90,7 @@ class PowerHintSession : public BnPowerHintSession { bool isAppSession(); const std::vector &getTidList() const; int getUclampMin(); + void dumpToStream(std::ostream &stream); private: class HintTimerHandler : public MessageHandler { diff --git a/power-libperfmgr/PowerSessionManager.cpp b/power-libperfmgr/PowerSessionManager.cpp index 284bd7a..984b0d0 100644 --- a/power-libperfmgr/PowerSessionManager.cpp +++ b/power-libperfmgr/PowerSessionManager.cpp @@ -19,6 +19,7 @@ #include "PowerSessionManager.h" +#include #include #include #include @@ -201,6 +202,28 @@ void PowerSessionManager::handleMessage(const Message &) { } } +void PowerSessionManager::dumpToFd(int fd) { + std::ostringstream dump_buf; + std::lock_guard guard(mLock); + dump_buf << "========== Begin PowerSessionManager ADPF list ==========\n"; + for (PowerHintSession *s : mSessions) { + s->dumpToStream(dump_buf); + dump_buf << " Tid:Ref["; + for (size_t i = 0, len = s->getTidList().size(); i < len; i++) { + int t = s->getTidList()[i]; + dump_buf << t << ":" << mTidSessionListMap[t].size(); + if (i < len - 1) { + dump_buf << ", "; + } + } + dump_buf << "]\n"; + } + dump_buf << "========== End PowerSessionManager ADPF list ==========\n"; + if (!::android::base::WriteStringToFd(dump_buf.str(), fd)) { + ALOGE("Failed to dump one of session list to fd:%d", fd); + } +} + void PowerSessionManager::enableSystemTopAppBoost() { if (HintManager::GetInstance()->IsHintSupported(kDisableBoostHintName)) { ALOGV("PowerSessionManager::enableSystemTopAppBoost!!"); diff --git a/power-libperfmgr/PowerSessionManager.h b/power-libperfmgr/PowerSessionManager.h index a244b83..9007659 100644 --- a/power-libperfmgr/PowerSessionManager.h +++ b/power-libperfmgr/PowerSessionManager.h @@ -52,8 +52,8 @@ class PowerSessionManager : public MessageHandler { void removePowerSession(PowerHintSession *session); void setUclampMin(PowerHintSession *session, int min); void setUclampMinLocked(PowerHintSession *session, int min); - void handleMessage(const Message &message) override; + void dumpToFd(int fd); // Singleton static sp getInstance() {