Re: [hatari-devel] Getting cycles used by previous or next instruction without modifying CPU state?

[ Thread Index | Date Index | More lists.tuxfamily.org/hatari-devel Archives ]


On 20/02/2012 23:50, Eero Tamminen wrote:
Hi,

How do I get how many cycles previous instruction used, for
profiling purposes?

src/debug/profile.c has this code:
         Uint32 opcode, cycles;
         opcode = get_iword_prefetch (0);
         cycles = (*cpufunctbl[opcode])(opcode) + nWaitStateCycles;

But that's bad, calling the opcode table function modifies
the CPU state.


Hello

I don't think you can get this easily. Only the current instruction cycles are available. Always saving current cycles in previous cycles before executing a new opcode would be too costy.

If that's just for test purpose, you can add some kind of breakpoint that would trigger on every instruction and then save the current cycles in your own variable. But this would certainly slow down emulation a lot.

Nicolas



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/