mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04:00
Fix IR profiling
This commit is contained in:
parent
5583dc10d5
commit
294593f741
5 changed files with 24 additions and 8 deletions
|
@ -33,7 +33,7 @@
|
|||
#include "stddef.h"
|
||||
#endif
|
||||
|
||||
#define IR_PROFILING
|
||||
// #define IR_PROFILING
|
||||
|
||||
namespace MIPSComp {
|
||||
|
||||
|
@ -163,6 +163,13 @@ public:
|
|||
}
|
||||
return meta;
|
||||
}
|
||||
JitBlockProfileStats GetBlockProfileStats(int blockNum) const { // Cheap
|
||||
#ifdef IR_PROFILING
|
||||
return blocks_[blockNum].profileStats_;
|
||||
#else
|
||||
return JitBlockProfileStats{};
|
||||
#endif
|
||||
}
|
||||
void ComputeStats(BlockCacheStats &bcStats) const override;
|
||||
int GetBlockNumberFromStartAddress(u32 em_address, bool realBlocksOnly = true) const override;
|
||||
|
||||
|
|
|
@ -730,6 +730,10 @@ int IRNativeBlockCacheDebugInterface::GetBlockNumberFromStartAddress(u32 em_addr
|
|||
return irBlocks_.GetBlockNumberFromStartAddress(em_address, realBlocksOnly);
|
||||
}
|
||||
|
||||
JitBlockProfileStats IRNativeBlockCacheDebugInterface::GetBlockProfileStats(int blockNum) const {
|
||||
return irBlocks_.GetBlockProfileStats(blockNum);
|
||||
}
|
||||
|
||||
void IRNativeBlockCacheDebugInterface::GetBlockCodeRange(int blockNum, int *startOffset, int *size) const {
|
||||
int blockOffset = irBlocks_.GetBlock(blockNum)->GetTargetOffset();
|
||||
int endOffset = backend_->GetNativeBlock(blockNum)->checkedOffset;
|
||||
|
|
|
@ -166,6 +166,7 @@ public:
|
|||
int GetBlockNumberFromStartAddress(u32 em_address, bool realBlocksOnly = true) const override;
|
||||
JitBlockDebugInfo GetBlockDebugInfo(int blockNum) const override;
|
||||
JitBlockMeta GetBlockMeta(int blockNum) const override;
|
||||
JitBlockProfileStats GetBlockProfileStats(int blockNum) const override;
|
||||
void ComputeStats(BlockCacheStats &bcStats) const override;
|
||||
bool IsValidBlock(int blockNum) const override;
|
||||
|
||||
|
|
|
@ -120,9 +120,7 @@ public:
|
|||
virtual int GetBlockNumberFromStartAddress(u32 em_address, bool realBlocksOnly = true) const = 0;
|
||||
virtual JitBlockDebugInfo GetBlockDebugInfo(int blockNum) const = 0; // Expensive
|
||||
virtual JitBlockMeta GetBlockMeta(int blockNum) const = 0;
|
||||
virtual JitBlockProfileStats GetBlockProfileStats(int blockNum) const { // Cheap
|
||||
return JitBlockProfileStats{};
|
||||
}
|
||||
virtual JitBlockProfileStats GetBlockProfileStats(int blockNum) const = 0;
|
||||
virtual void ComputeStats(BlockCacheStats &bcStats) const = 0;
|
||||
virtual bool IsValidBlock(int blockNum) const = 0;
|
||||
virtual bool SupportsProfiling() const { return false; }
|
||||
|
@ -191,6 +189,9 @@ public:
|
|||
}
|
||||
return meta;
|
||||
}
|
||||
JitBlockProfileStats GetBlockProfileStats(int blockNum) const override {
|
||||
return JitBlockProfileStats{};
|
||||
}
|
||||
|
||||
static int GetBlockExitSize();
|
||||
|
||||
|
|
|
@ -47,12 +47,14 @@ void JitCompareScreen::CreateViews() {
|
|||
return UI::EVENT_DONE;
|
||||
});
|
||||
blockTopBar->Add(new Button("", ImageID("I_ARROW_LEFT")))->OnClick.Add([=](UI::EventParams &e) {
|
||||
currentBlock_--;
|
||||
if (currentBlock_ >= 1)
|
||||
currentBlock_--;
|
||||
UpdateDisasm();
|
||||
return UI::EVENT_DONE;
|
||||
});
|
||||
blockTopBar->Add(new Button("", ImageID("I_ARROW_RIGHT")))->OnClick.Add([=](UI::EventParams &e) {
|
||||
currentBlock_++;
|
||||
if (currentBlock_ < blockList_.size() - 1)
|
||||
currentBlock_++;
|
||||
UpdateDisasm();
|
||||
return UI::EVENT_DONE;
|
||||
});
|
||||
|
@ -276,10 +278,11 @@ void JitCompareScreen::UpdateDisasm() {
|
|||
} else {
|
||||
blockListContainer_->Clear();
|
||||
for (int i = 0; i < std::min(100, (int)blockList_.size()); i++) {
|
||||
JitBlockMeta meta = blockCacheDebug->GetBlockMeta(blockList_[i]);
|
||||
int blockNum = blockList_[i];
|
||||
JitBlockMeta meta = blockCacheDebug->GetBlockMeta(blockNum);
|
||||
char temp[512], small[512];
|
||||
if (blockCacheDebug->SupportsProfiling()) {
|
||||
JitBlockProfileStats stats = blockCacheDebug->GetBlockProfileStats(blockList_[i]);
|
||||
JitBlockProfileStats stats = blockCacheDebug->GetBlockProfileStats(blockNum);
|
||||
int execs = (int)stats.executions;
|
||||
double us = (double)stats.totalNanos / 1000.0;
|
||||
snprintf(temp, sizeof(temp), "%08x: %d instrs (%d exec, %0.2f us)", meta.addr, meta.sizeInBytes / 4, execs, us);
|
||||
|
|
Loading…
Add table
Reference in a new issue