Merge pull request #2966 from Sonicadvance1/profile_add_runcount

Add run count to the JIT profile information
This commit is contained in:
Ryan Houdek 2015-09-08 11:18:36 -05:00
commit 631fe4ffc2
2 changed files with 8 additions and 6 deletions

View file

@ -118,14 +118,14 @@ namespace JitInterface
PanicAlert("Failed to open %s", filename.c_str());
return;
}
fprintf(f.GetHandle(), "origAddr\tblkName\tcost\ttimeCost\tpercent\ttimePercent\tOvAllinBlkTime(ms)\tblkCodeSize\n");
fprintf(f.GetHandle(), "origAddr\tblkName\trunCount\tcost\ttimeCost\tpercent\ttimePercent\tOvAllinBlkTime(ms)\tblkCodeSize\n");
for (auto& stat : prof_stats.block_stats)
{
std::string name = g_symbolDB.GetDescription(stat.addr);
double percent = 100.0 * (double)stat.cost / (double)prof_stats.cost_sum;
double timePercent = 100.0 * (double)stat.tick_counter / (double)prof_stats.timecost_sum;
fprintf(f.GetHandle(), "%08x\t%s\t%llu\t%llu\t%.2f\t%.2f\t%.2f\t%i\n",
stat.addr, name.c_str(), stat.cost,
fprintf(f.GetHandle(), "%08x\t%s\t%llu\t%llu\t%llu\t%.2f\t%.2f\t%.2f\t%i\n",
stat.addr, name.c_str(), stat.run_count, stat.cost,
stat.tick_counter, percent, timePercent,
(double)stat.tick_counter*1000.0/(double)prof_stats.countsPerSec, stat.block_size);
}
@ -156,7 +156,8 @@ namespace JitInterface
// Todo: tweak.
if (block->runCount >= 1)
prof_stats->block_stats.emplace_back(i, block->originalAddress,
cost, timecost, block->codeSize);
cost, timecost,
block->runCount, block->codeSize);
prof_stats->cost_sum += cost;
prof_stats->timecost_sum += timecost;
}

View file

@ -44,12 +44,13 @@
struct BlockStat
{
BlockStat(int bn, u32 _addr, u64 c, u64 ticks, u32 size) :
blockNum(bn), addr(_addr), cost(c), tick_counter(ticks), block_size(size) {}
BlockStat(int bn, u32 _addr, u64 c, u64 ticks, u64 run, u32 size) :
blockNum(bn), addr(_addr), cost(c), tick_counter(ticks), run_count(run), block_size(size) {}
int blockNum;
u32 addr;
u64 cost;
u64 tick_counter;
u64 run_count;
u32 block_size;
bool operator <(const BlockStat &other) const