Added debug code to log execution rate of non-recompiled instructions.

This commit is contained in:
SarahW 2018-11-24 20:16:52 +00:00
commit 2a19183d83
8 changed files with 115 additions and 2 deletions

View file

@ -46,10 +46,45 @@ static uint32_t last_op32;
static x86seg *last_ea_seg;
static int last_ssegs;
#ifdef DEBUG_EXTRA
uint32_t instr_counts[256*256];
#endif
void codegen_init()
{
codegen_backend_init();
#ifdef DEBUG_EXTRA
memset(instr_counts, 0, sizeof(instr_counts));
#endif
}
void codegen_close()
{
#ifdef DEBUG_EXTRA
pclog("Instruction counts :\n");
while (1)
{
int c;
uint32_t highest_num = 0, highest_idx = 0;
for (c = 0; c < 256*256; c++)
{
if (instr_counts[c] > highest_num)
{
highest_num = instr_counts[c];
highest_idx = c;
}
}
if (!highest_num)
break;
instr_counts[highest_idx] = 0;
if (highest_idx > 256)
pclog(" %02x %02x = %u\n", highest_idx >> 8, highest_idx & 0xff, highest_num);
else
pclog(" %02x = %u\n", highest_idx & 0xff, highest_num);
}
#endif
}
void codegen_reset()