mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04:00
irjit: Calculate bloat statistics.
At least based on IR for now. Can do something else later. memset() was causing a crash on the std::map.
This commit is contained in:
parent
2709472abd
commit
0bfab27b46
1 changed files with 26 additions and 2 deletions
|
@ -234,9 +234,33 @@ JitBlockDebugInfo IRBlockCache::GetBlockDebugInfo(int blockNum) const {
|
|||
}
|
||||
|
||||
void IRBlockCache::ComputeStats(BlockCacheStats &bcStats) const {
|
||||
// TODO: Implement properly
|
||||
memset(&bcStats, 0, sizeof(bcStats));
|
||||
double totalBloat = 0.0;
|
||||
double maxBloat = 0.0;
|
||||
double minBloat = 1000000000.0;
|
||||
for (const auto &b : blocks_) {
|
||||
double codeSize = (double)b.GetNumInstructions() * sizeof(IRInst);
|
||||
if (codeSize == 0)
|
||||
continue;
|
||||
|
||||
u32 origAddr, mipsBytes;
|
||||
b.GetRange(origAddr, mipsBytes);
|
||||
double origSize = (double)mipsBytes;
|
||||
double bloat = codeSize / origSize;
|
||||
if (bloat < minBloat) {
|
||||
minBloat = bloat;
|
||||
bcStats.minBloatBlock = origAddr;
|
||||
}
|
||||
if (bloat > maxBloat) {
|
||||
maxBloat = bloat;
|
||||
bcStats.maxBloatBlock = origAddr;
|
||||
}
|
||||
totalBloat += bloat;
|
||||
bcStats.bloatMap[bloat] = origAddr;
|
||||
}
|
||||
bcStats.numBlocks = (int)blocks_.size();
|
||||
bcStats.minBloat = minBloat;
|
||||
bcStats.maxBloat = maxBloat;
|
||||
bcStats.avgBloat = totalBloat / (double)blocks_.size();
|
||||
}
|
||||
|
||||
int IRBlockCache::GetBlockNumberFromStartAddress(u32 em_address, bool realBlocksOnly) const {
|
||||
|
|
Loading…
Add table
Reference in a new issue