sm6375-common: power-libperfmgr: ADPF: dump ADPF session info

Dump current ADPF profile and ADPF session list into bugreport.

Bug: 204444691
Test: adb root && adb shell dumpsys android.hardware.power.IPower/default
Test: gpaste/6469309887938560
Change-Id: I17c0d615051f5e51c2e1fe99d17c402f9a65679a
This commit is contained in:
jimmyshiu 2024-07-18 12:56:42 +05:30 committed by Anand S
parent 0ddf7227e4
commit 014cb76f74
No known key found for this signature in database
GPG key ID: 3B2983FA448B3D61
5 changed files with 33 additions and 1 deletions

View file

@ -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";
}

View file

@ -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");

View file

@ -90,6 +90,7 @@ class PowerHintSession : public BnPowerHintSession {
bool isAppSession();
const std::vector<int> &getTidList() const;
int getUclampMin();
void dumpToStream(std::ostream &stream);
private:
class HintTimerHandler : public MessageHandler {

View file

@ -19,6 +19,7 @@
#include "PowerSessionManager.h"
#include <android-base/file.h>
#include <log/log.h>
#include <perfmgr/HintManager.h>
#include <processgroup/processgroup.h>
@ -201,6 +202,28 @@ void PowerSessionManager::handleMessage(const Message &) {
}
}
void PowerSessionManager::dumpToFd(int fd) {
std::ostringstream dump_buf;
std::lock_guard<std::mutex> 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!!");

View file

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