Add run count to the JIT profile information

This commit is contained in:
Ryan Houdek 2015-09-04 20:15:13 -05:00
parent 81c07d4919
commit 5d7f834cde
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()); PanicAlert("Failed to open %s", filename.c_str());
return; 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) for (auto& stat : prof_stats.block_stats)
{ {
std::string name = g_symbolDB.GetDescription(stat.addr); std::string name = g_symbolDB.GetDescription(stat.addr);
double percent = 100.0 * (double)stat.cost / (double)prof_stats.cost_sum; 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; 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", 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.cost, stat.addr, name.c_str(), stat.run_count, stat.cost,
stat.tick_counter, percent, timePercent, stat.tick_counter, percent, timePercent,
(double)stat.tick_counter*1000.0/(double)prof_stats.countsPerSec, stat.block_size); (double)stat.tick_counter*1000.0/(double)prof_stats.countsPerSec, stat.block_size);
} }
@ -156,7 +156,8 @@ namespace JitInterface
// Todo: tweak. // Todo: tweak.
if (block->runCount >= 1) if (block->runCount >= 1)
prof_stats->block_stats.emplace_back(i, block->originalAddress, 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->cost_sum += cost;
prof_stats->timecost_sum += timecost; prof_stats->timecost_sum += timecost;
} }

View File

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