I am looking to profile some code in a real time operating system, RTEMS
. Essentially, rtems has a bunch of functions to read the time, the most useful of which is rtems_clock_get_ticks_since_boot
.
The problem here is that for whatever reason the clock ticks reported are synchronized with our state machine loop rate, 5kHz
whereas the processor is running at around 200MHz
(embedded system). I know this because i recorded the clock time, waited 1 sec and only 5000 ticks had gone by.
So the question is:
How can I get the actual CPU ticks from RTEMS?
PS.
clock()
from GNU C (has the same problem)
There is a guide that i have been looking into here, but I get impossible constraint in asm
which indicates that i would need to use some different assembler keywords. Maybe someone can point me to something similar?
Context
I want to profile some code, so essentially:
start = cpu_clock_ticks()
//Some code
time = cpu_clock_ticks() - start;
The code runs in less than 0.125ms so the 8khz counter that clock()
and other rtems functions get, wont cut it.