Hello,
I want to check code execution time.
I have tried with Clock_gettime which resolution is 1 ns, but I didn't
get execution time of following sample program.
I have tried to run this on Angstrom Demo Kernel but I didn't get time
difference in start and end time. So what is resolution of this clock
function?
Is there any other way to check execution time?
You really shouldn’t try to measure really small times because interrupts / context switches will screw your timings up. Nanosecond timers aren’t necessarily accurate - don’t know about OMAP and the crystals / clocks on the BB but other systems I’ve used range from ok to horrific.
Instead make sure nothing else much is running, nice your test program to have a high priority and run whatever test code 1,000 times or 1,000,000 times to get a decent test run of at least 10 seconds. Ideally around a minute.
If you are worried about wrapper code (e.g. the for loop taking up CPU time) - or if you actually need to clean up the processor state / test data etc then take two sets of timings. First with your code in it and second without your code in it. The difference is then the chunk of code you are interested in.