On 01/05/2015 00:02, Peter Maydell wrote: > On 30 April 2015 at 22:33, Christopher Covington > <christopher.coving...@linaro.org> wrote: >> On Apr 30, 2015 2:28 PM, "Peter Maydell" <peter.mayd...@linaro.org> wrote: >>> Are you really really sure the _raw function is the correct one? >>> Nowhere else in the codebase calls it except the other wrappers >>> in cpu.c which provide a sane view of the instruction count... >>> (I suspect cpu_get_icount_raw() should really be static.) >> >> I thought it wasn't being used because it was new, having been introduced by >> Pavel Dovgalyuk's determinism patches. >> >> When you talk about sanity, what would this patch make insane?
The right function is cpu_get_ticks(). This one works without icount as well. At the top there is: if (use_icount) { return cpu_get_icount(); } and perhaps it would be correct to use cpu_get_icount_raw() if you do not want the cycle counter to increase in halted state. But at least x86 wants it to increase. Paolo The >> instructions per second and cycles per second that would result? If so, what >> if seconds/timer ticks were changed in the same patch to be derived from the >> instruction count. All of this could potentially only apply with -icount >> specified. > > I don't really know for certain how the code here works, but > it makes me very dubious when I see a function that is being > used literally nowhere else in any other target CPU, and > where every other code path to it goes via taking a lock. > > Paolo: can you suggest what the right function to call to implement > a cycle counter is? > > thanks > -- PMM >