mirror of
https://github.com/hrydgard/ppsspp.git
synced 2024-11-26 23:10:38 +00:00
Add a stats view
This commit is contained in:
parent
d1a00f61de
commit
0ea9120ca5
@ -465,7 +465,6 @@ void IRBlockCache::ComputeStats(BlockCacheStats &bcStats) const {
|
|||||||
bcStats.maxBloatBlock = origAddr;
|
bcStats.maxBloatBlock = origAddr;
|
||||||
}
|
}
|
||||||
totalBloat += bloat;
|
totalBloat += bloat;
|
||||||
bcStats.bloatMap[bloat] = origAddr;
|
|
||||||
}
|
}
|
||||||
bcStats.numBlocks = (int)blocks_.size();
|
bcStats.numBlocks = (int)blocks_.size();
|
||||||
bcStats.minBloat = minBloat;
|
bcStats.minBloat = minBloat;
|
||||||
|
@ -801,7 +801,6 @@ void IRNativeBlockCacheDebugInterface::ComputeStats(BlockCacheStats &bcStats) co
|
|||||||
bcStats.maxBloatBlock = origAddr;
|
bcStats.maxBloatBlock = origAddr;
|
||||||
}
|
}
|
||||||
totalBloat += bloat;
|
totalBloat += bloat;
|
||||||
bcStats.bloatMap[(float)bloat] = origAddr;
|
|
||||||
}
|
}
|
||||||
bcStats.numBlocks = numBlocks;
|
bcStats.numBlocks = numBlocks;
|
||||||
bcStats.minBloat = (float)minBloat;
|
bcStats.minBloat = (float)minBloat;
|
||||||
|
@ -681,7 +681,6 @@ void JitBlockCache::ComputeStats(BlockCacheStats &bcStats) const {
|
|||||||
bcStats.maxBloatBlock = b->originalAddress;
|
bcStats.maxBloatBlock = b->originalAddress;
|
||||||
}
|
}
|
||||||
totalBloat += bloat;
|
totalBloat += bloat;
|
||||||
bcStats.bloatMap[(float)bloat] = b->originalAddress;
|
|
||||||
}
|
}
|
||||||
bcStats.numBlocks = num_blocks_;
|
bcStats.numBlocks = num_blocks_;
|
||||||
bcStats.minBloat = (float)minBloat;
|
bcStats.minBloat = (float)minBloat;
|
||||||
@ -710,6 +709,5 @@ JitBlockDebugInfo JitBlockCache::GetBlockDebugInfo(int blockNum) const {
|
|||||||
#elif PPSSPP_ARCH(RISCV64)
|
#elif PPSSPP_ARCH(RISCV64)
|
||||||
debugInfo.targetDisasm = DisassembleRV64(block->normalEntry, block->codeSize);
|
debugInfo.targetDisasm = DisassembleRV64(block->normalEntry, block->codeSize);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return debugInfo;
|
return debugInfo;
|
||||||
}
|
}
|
||||||
|
@ -42,7 +42,6 @@ struct BlockCacheStats {
|
|||||||
u32 minBloatBlock;
|
u32 minBloatBlock;
|
||||||
float maxBloat;
|
float maxBloat;
|
||||||
u32 maxBloatBlock;
|
u32 maxBloatBlock;
|
||||||
std::map<float, u32> bloatMap;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
enum class DestroyType {
|
enum class DestroyType {
|
||||||
|
@ -21,14 +21,22 @@ JitCompareScreen::JitCompareScreen() : UIDialogScreenWithBackground() {
|
|||||||
|
|
||||||
void JitCompareScreen::Flip() {
|
void JitCompareScreen::Flip() {
|
||||||
using namespace UI;
|
using namespace UI;
|
||||||
|
// If we add more, let's convert to a for loop.
|
||||||
switch (viewMode_) {
|
switch (viewMode_) {
|
||||||
case ViewMode::DISASM:
|
case ViewMode::DISASM:
|
||||||
comparisonView_->SetVisibility(V_VISIBLE);
|
comparisonView_->SetVisibility(V_VISIBLE);
|
||||||
blockListView_->SetVisibility(V_GONE);
|
blockListView_->SetVisibility(V_GONE);
|
||||||
|
statsView_->SetVisibility(V_GONE);
|
||||||
break;
|
break;
|
||||||
case ViewMode::BLOCK_LIST:
|
case ViewMode::BLOCK_LIST:
|
||||||
comparisonView_->SetVisibility(V_GONE);
|
comparisonView_->SetVisibility(V_GONE);
|
||||||
blockListView_->SetVisibility(V_VISIBLE);
|
blockListView_->SetVisibility(V_VISIBLE);
|
||||||
|
statsView_->SetVisibility(V_GONE);
|
||||||
|
break;
|
||||||
|
case ViewMode::STATS:
|
||||||
|
comparisonView_->SetVisibility(V_GONE);
|
||||||
|
blockListView_->SetVisibility(V_GONE);
|
||||||
|
statsView_->SetVisibility(V_VISIBLE);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -130,6 +138,13 @@ void JitCompareScreen::CreateViews() {
|
|||||||
ScrollView *blockScroll = blockListView_->Add(new ScrollView(ORIENT_VERTICAL, new LinearLayoutParams(1.0f)));
|
ScrollView *blockScroll = blockListView_->Add(new ScrollView(ORIENT_VERTICAL, new LinearLayoutParams(1.0f)));
|
||||||
blockListContainer_ = blockScroll->Add(new LinearLayout(ORIENT_VERTICAL));
|
blockListContainer_ = blockScroll->Add(new LinearLayout(ORIENT_VERTICAL));
|
||||||
|
|
||||||
|
statsView_ = root_->Add(new LinearLayout(ORIENT_VERTICAL, new LinearLayoutParams(1.0f)));
|
||||||
|
statsView_->SetVisibility(V_GONE);
|
||||||
|
|
||||||
|
LinearLayout *statsTopBar = statsView_->Add(new LinearLayout(ORIENT_HORIZONTAL, new LinearLayoutParams(FILL_PARENT, WRAP_CONTENT)));
|
||||||
|
ScrollView *statsScroll = statsView_->Add(new ScrollView(ORIENT_VERTICAL, new LinearLayoutParams(1.0f)));
|
||||||
|
statsContainer_ = statsScroll->Add(new LinearLayout(ORIENT_VERTICAL, new LinearLayoutParams(FILL_PARENT, WRAP_CONTENT)));
|
||||||
|
|
||||||
// leftColumn->Add(new Choice(dev->T("By Address")))->OnClick.Handle(this, &JitCompareScreen::OnSelectBlock);
|
// leftColumn->Add(new Choice(dev->T("By Address")))->OnClick.Handle(this, &JitCompareScreen::OnSelectBlock);
|
||||||
leftColumn->Add(new Choice(dev->T("All")))->OnClick.Add([=](UI::EventParams &e) {
|
leftColumn->Add(new Choice(dev->T("All")))->OnClick.Add([=](UI::EventParams &e) {
|
||||||
listType_ = ListType::ALL_BLOCKS;
|
listType_ = ListType::ALL_BLOCKS;
|
||||||
@ -295,9 +310,18 @@ void JitCompareScreen::UpdateDisasm() {
|
|||||||
|
|
||||||
int numMips = leftDisasm_->GetNumSubviews();
|
int numMips = leftDisasm_->GetNumSubviews();
|
||||||
int numHost = rightDisasm_->GetNumSubviews();
|
int numHost = rightDisasm_->GetNumSubviews();
|
||||||
snprintf(temp, sizeof(temp), "%d to %d : %d%%", numMips, numHost, 100 * numHost / numMips);
|
double bloat = 100.0 * numHost / numMips;
|
||||||
|
if (blockCacheDebug->SupportsProfiling()) {
|
||||||
|
JitBlockProfileStats stats = blockCacheDebug->GetBlockProfileStats(blockNum);
|
||||||
|
int execs = (int)stats.executions;
|
||||||
|
double us = (double)stats.totalNanos / 1000000.0;
|
||||||
|
double percentage = 100.0 * (double)stats.totalNanos / (double)sumTotalNanos_;
|
||||||
|
snprintf(temp, sizeof(temp), "%d runs, %0.2f ms, %0.2f%%, bloat: %0.1f%%", execs, us, percentage, bloat);
|
||||||
|
} else {
|
||||||
|
snprintf(temp, sizeof(temp), "bloat: %0.1f%%", bloat);
|
||||||
|
}
|
||||||
blockStats_->SetText(temp);
|
blockStats_->SetText(temp);
|
||||||
} else {
|
} else if (viewMode_ == ViewMode::BLOCK_LIST) {
|
||||||
blockListContainer_->Clear();
|
blockListContainer_->Clear();
|
||||||
bool profiling = blockCacheDebug->SupportsProfiling();
|
bool profiling = blockCacheDebug->SupportsProfiling();
|
||||||
for (int i = 0; i < std::min(100, (int)blockList_.size()); i++) {
|
for (int i = 0; i < std::min(100, (int)blockList_.size()); i++) {
|
||||||
@ -309,7 +333,7 @@ void JitCompareScreen::UpdateDisasm() {
|
|||||||
int execs = (int)stats.executions;
|
int execs = (int)stats.executions;
|
||||||
double us = (double)stats.totalNanos / 1000000.0;
|
double us = (double)stats.totalNanos / 1000000.0;
|
||||||
double percentage = 100.0 * (double)stats.totalNanos / (double)sumTotalNanos_;
|
double percentage = 100.0 * (double)stats.totalNanos / (double)sumTotalNanos_;
|
||||||
snprintf(temp, sizeof(temp), "%08x: %d instrs (%d exec, %0.2f ms, %0.2f%%)", meta.addr, meta.sizeInBytes / 4, execs, us, percentage);
|
snprintf(temp, sizeof(temp), "%08x: %d instrs (%d runs, %0.2f ms, %0.2f%%)", meta.addr, meta.sizeInBytes / 4, execs, us, percentage);
|
||||||
} else {
|
} else {
|
||||||
snprintf(temp, sizeof(temp), "%08x: %d instrs", meta.addr, meta.sizeInBytes / 4);
|
snprintf(temp, sizeof(temp), "%08x: %d instrs", meta.addr, meta.sizeInBytes / 4);
|
||||||
}
|
}
|
||||||
@ -317,6 +341,24 @@ void JitCompareScreen::UpdateDisasm() {
|
|||||||
Choice *blockChoice = blockListContainer_->Add(new Choice(temp, small));
|
Choice *blockChoice = blockListContainer_->Add(new Choice(temp, small));
|
||||||
blockChoice->OnClick.Handle(this, &JitCompareScreen::OnBlockClick);
|
blockChoice->OnClick.Handle(this, &JitCompareScreen::OnBlockClick);
|
||||||
}
|
}
|
||||||
|
} else { // viewMode_ == ViewMode::STATS
|
||||||
|
statsContainer_->Clear();
|
||||||
|
|
||||||
|
BlockCacheStats bcStats;
|
||||||
|
blockCacheDebug->ComputeStats(bcStats);
|
||||||
|
|
||||||
|
char stats[1024];
|
||||||
|
snprintf(stats, sizeof(stats),
|
||||||
|
"Num blocks: %d\n"
|
||||||
|
"Average Bloat: %0.2f%%\n"
|
||||||
|
"Min Bloat: %0.2f%% (%08x)\n"
|
||||||
|
"Max Bloat: %0.2f%% (%08x)\n",
|
||||||
|
blockCacheDebug->GetNumBlocks(),
|
||||||
|
100.0 * bcStats.avgBloat,
|
||||||
|
100.0 * bcStats.minBloat, bcStats.minBloatBlock,
|
||||||
|
100.0 * bcStats.maxBloat, bcStats.maxBloatBlock);
|
||||||
|
|
||||||
|
statsContainer_->Add(new TextView(stats));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -356,26 +398,8 @@ UI::EventReturn JitCompareScreen::OnShowStats(UI::EventParams &e) {
|
|||||||
return UI::EVENT_DONE;
|
return UI::EVENT_DONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
JitBlockCacheDebugInterface *blockCache = MIPSComp::jit->GetBlockCacheDebugInterface();
|
viewMode_ = ViewMode::STATS;
|
||||||
if (!blockCache)
|
UpdateDisasm();
|
||||||
return UI::EVENT_DONE;
|
|
||||||
|
|
||||||
BlockCacheStats bcStats;
|
|
||||||
blockCache->ComputeStats(bcStats);
|
|
||||||
NOTICE_LOG(JIT, "Num blocks: %i", bcStats.numBlocks);
|
|
||||||
NOTICE_LOG(JIT, "Average Bloat: %0.2f%%", 100 * bcStats.avgBloat);
|
|
||||||
NOTICE_LOG(JIT, "Min Bloat: %0.2f%% (%08x)", 100 * bcStats.minBloat, bcStats.minBloatBlock);
|
|
||||||
NOTICE_LOG(JIT, "Max Bloat: %0.2f%% (%08x)", 100 * bcStats.maxBloat, bcStats.maxBloatBlock);
|
|
||||||
|
|
||||||
int ctr = 0, sz = (int)bcStats.bloatMap.size();
|
|
||||||
for (auto iter : bcStats.bloatMap) {
|
|
||||||
if (ctr < 10 || ctr > sz - 10) {
|
|
||||||
NOTICE_LOG(JIT, "%08x: %f", iter.second, iter.first);
|
|
||||||
} else if (ctr == 10) {
|
|
||||||
NOTICE_LOG(JIT, "...");
|
|
||||||
}
|
|
||||||
ctr++;
|
|
||||||
}
|
|
||||||
return UI::EVENT_DONE;
|
return UI::EVENT_DONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,9 +17,15 @@ private:
|
|||||||
void FillBlockList();
|
void FillBlockList();
|
||||||
|
|
||||||
UI::LinearLayout *comparisonView_;
|
UI::LinearLayout *comparisonView_;
|
||||||
|
UI::LinearLayout *leftDisasm_;
|
||||||
|
UI::LinearLayout *rightDisasm_;
|
||||||
|
|
||||||
UI::LinearLayout *blockListView_;
|
UI::LinearLayout *blockListView_;
|
||||||
UI::LinearLayout *blockListContainer_;
|
UI::LinearLayout *blockListContainer_;
|
||||||
|
|
||||||
|
UI::LinearLayout *statsView_;
|
||||||
|
UI::LinearLayout *statsContainer_;
|
||||||
|
|
||||||
UI::EventReturn OnSelectBlock(UI::EventParams &e);
|
UI::EventReturn OnSelectBlock(UI::EventParams &e);
|
||||||
UI::EventReturn OnBlockAddress(UI::EventParams &e);
|
UI::EventReturn OnBlockAddress(UI::EventParams &e);
|
||||||
UI::EventReturn OnAddressChange(UI::EventParams &e);
|
UI::EventReturn OnAddressChange(UI::EventParams &e);
|
||||||
@ -30,6 +36,7 @@ private:
|
|||||||
enum class ViewMode {
|
enum class ViewMode {
|
||||||
BLOCK_LIST,
|
BLOCK_LIST,
|
||||||
DISASM,
|
DISASM,
|
||||||
|
STATS,
|
||||||
};
|
};
|
||||||
enum class ListType {
|
enum class ListType {
|
||||||
ALL_BLOCKS,
|
ALL_BLOCKS,
|
||||||
@ -56,9 +63,6 @@ private:
|
|||||||
UI::TextView *blockName_;
|
UI::TextView *blockName_;
|
||||||
UI::TextEdit *blockAddr_;
|
UI::TextEdit *blockAddr_;
|
||||||
UI::TextView *blockStats_;
|
UI::TextView *blockStats_;
|
||||||
|
|
||||||
UI::LinearLayout *leftDisasm_;
|
|
||||||
UI::LinearLayout *rightDisasm_;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class AddressPromptScreen : public PopupScreen {
|
class AddressPromptScreen : public PopupScreen {
|
||||||
|
Loading…
Reference in New Issue
Block a user