There is currently a libc function clock(). This is used, for example, in several apps to display frame rates. This calls get_cycle_count(), which uses the cycle count control register. On the emulator, get_cycle_count returns the number of instructions executed, so the timing is not accurate. I previously had modified the emulator to make the cycle count control register be based on real time and a simulated clock rate, but this breaks benchmarks.
I think the right solution is to create a set of device registers that return "wall clock" time. On hardware, this would be a dividing counter. On the emulator, it could map to a call to 'time' on the host platform.
There is currently a libc function clock(). This is used, for example, in several apps to display frame rates. This calls get_cycle_count(), which uses the cycle count control register. On the emulator, get_cycle_count returns the number of instructions executed, so the timing is not accurate. I previously had modified the emulator to make the cycle count control register be based on real time and a simulated clock rate, but this breaks benchmarks.
I think the right solution is to create a set of device registers that return "wall clock" time. On hardware, this would be a dividing counter. On the emulator, it could map to a call to 'time' on the host platform.