Tool/software:
Hi,
I am running am64x demo board without os.
Is there a way or example to measure the CPU running cycle?
how fast cpu runs.
Thanks
Hello Jun,
Are you expecting CPU load %?
Regards,
Anil.
no, I just want to know what speed that cpu runs.
Bootloader_socCpuGetClock(corid); and it is 800mhz. cpu runs at 800mhz
then, I do the measurement myself.
startTime = ClockP_getTimeUsec();
int jj=0;
for(jj=0;jj<1000000;jj++);
endTime = ClockP_getTimeUsec();
the end time- start time is 13814
13814 /1000000 (loop count) = 13 nano second for one dummy instruction, that is not right? it is too slow.
it suppose to have max 2 nano second to run one dummy increment jj++ instruntion on 800mhz system, right?
Hi,
that loop is more than one instruction. At the very least this would have to increment a register, then compare it against the 1000000, and branch back if less.
If you were using a release build the compiler would have eliminated that loop. In a debug build (without optimizations) it is probably going to read and write jj from memory in each loop.
There could also be a load-use hazard because the processor needs the loaded value before it can decrement and compare.
Next you should think about where the code and data resides, and what the access latency is. TCM and L1 cache is single cycle, SRAM would be dozens of cycles, and DDR would be more than 100 cycles.
Assuming this runs all out of L1 cache you could look at the disassembly to see what instructions make up your loop, then check the ARM Cortex-R5 documentation for instruction cycle timings, and then see if that matches 1.25ns per cycle. For the disassembly use the CCS assembly view or objdump.
To make your life even more complicated, the R5 could even execute two instructions in a single cycle, if the instructions are suitable.
-> Might be an interesting exercise, but probably not worth the effort.
Regards,
Dominic
Hello Jun,
The above, Dominic, answer a fair answer and I hope the answer clears your doubts.
Dominic, thanks for chiming in.
Regards,
Anil.