Re: [hatari-devel] Bogus profiler CPU cycles values

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


Le 15/02/2013 13:12, Eero Tamminen a écrit :
I.e. I'd like to remove the if line here so that counter is
always reset in CPU cores:
----
                 /* Clear M68000 cycle counter */
                 if (bDspEnabled)
                         Cycles_SetCounter(CYCLES_COUNTER_CPU, 0);
----

As it's in the CPU main loop, it obviously has some effect
on speed.  Compared to earlier, speed decreases a bit when DSP is
disabled (as it now always updates CPU counter), and potentially
increases when DSP is enabled (as there's one if less).

Comments, or objections to this?

I would still be interested on comments to this...


Hello

I'm not sure that the code as it is now is the best way to measure the number of cycles spent in the DSP.

So far, CYCLES_COUNTER_CPU is only used for the dsp cycles, so resetting it has no side effect.

But from a "semantic" point of view, CYCLES_COUNTER_CPU should be IMO a global counter that never resets and permanently increments (for this to be correct it should be 64 bit, not 32 bit). This counter would count all cpu cycles since previous cold/warm reset.

So, to count cycles between 2 points, it would be better to subtract the 2 consecutive values of Cycles_GetCounter(CYCLES_COUNTER_CPU).

At the moment, this is not the case, so I think you can remove the 'if' if you want ; but in a few months, when other more important parts are fixed, I think we will have to change this and you will have to update your code, but this shouldn't be a big change.

Nicolas



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