mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04:00
Add a way to monitor the icon cache from the system info screen.
This commit is contained in:
parent
8a27627a9f
commit
cb5926761b
3 changed files with 38 additions and 0 deletions
|
@ -225,3 +225,18 @@ Draw::Texture *IconCache::BindIconTexture(UIContext *context, const std::string
|
|||
|
||||
return texture;
|
||||
}
|
||||
|
||||
IconCacheStats IconCache::GetStats() {
|
||||
IconCacheStats stats{};
|
||||
|
||||
std::unique_lock<std::mutex> lock(lock_);
|
||||
|
||||
for (auto &iter : cache_) {
|
||||
stats.cachedCount++;
|
||||
if (iter.second.texture)
|
||||
stats.textureCount++;
|
||||
stats.dataSize += iter.second.data.size();
|
||||
}
|
||||
|
||||
return stats;
|
||||
}
|
||||
|
|
|
@ -20,6 +20,12 @@ class Texture;
|
|||
|
||||
// TODO: Possibly make this smarter and use instead of ManagedTexture?
|
||||
|
||||
struct IconCacheStats {
|
||||
size_t cachedCount;
|
||||
size_t textureCount; // number of cached images that are "live" textures
|
||||
size_t dataSize;
|
||||
};
|
||||
|
||||
class IconCache {
|
||||
public:
|
||||
Draw::Texture *BindIconTexture(UIContext *context, const std::string &key);
|
||||
|
@ -35,6 +41,8 @@ public:
|
|||
void ClearTextures();
|
||||
void ClearData();
|
||||
|
||||
IconCacheStats GetStats();
|
||||
|
||||
private:
|
||||
struct Entry {
|
||||
std::string data;
|
||||
|
|
|
@ -43,6 +43,8 @@
|
|||
#include "Common/UI/View.h"
|
||||
#include "Common/UI/ViewGroup.h"
|
||||
#include "Common/UI/UI.h"
|
||||
#include "Common/UI/IconCache.h"
|
||||
#include "Common/Data/Text/Parsers.h"
|
||||
#include "Common/Profiler/Profiler.h"
|
||||
|
||||
#include "Common/LogManager.h"
|
||||
|
@ -782,6 +784,19 @@ void SystemInfoScreen::CreateTabs() {
|
|||
gpuExtensions->Add(new TextView(extension, new LayoutParams(FILL_PARENT, WRAP_CONTENT)))->SetFocusable(true);
|
||||
}
|
||||
}
|
||||
|
||||
LinearLayout *internals = AddTab("DevSystemInfoInternals", si->T("Internals"));
|
||||
|
||||
internals->Add(new ItemHeader(si->T("Icon cache")));
|
||||
IconCacheStats iconStats = g_iconCache.GetStats();
|
||||
internals->Add(new InfoItem(si->T("Image data count"), StringFromFormat("%d", iconStats.cachedCount)));
|
||||
internals->Add(new InfoItem(si->T("Texture count"), StringFromFormat("%d", iconStats.textureCount)));
|
||||
internals->Add(new InfoItem(si->T("Data size"), NiceSizeFormat(iconStats.dataSize)));
|
||||
internals->Add(new Choice(di->T("Clear")))->OnClick.Add([&](UI::EventParams &) {
|
||||
g_iconCache.ClearData();
|
||||
RecreateViews();
|
||||
return UI::EVENT_DONE;
|
||||
});
|
||||
}
|
||||
|
||||
void AddressPromptScreen::CreatePopupContents(UI::ViewGroup *parent) {
|
||||
|
|
Loading…
Add table
Reference in a new issue