I try to measure the clock cyles needed to execute a piece of code on the TMS32064x+ DSP that comes with the OMAP ZOOM 3430 MDK. I look at the "Programmer's Guide" of the DSP chip and it says that the DSP supports the clock() function.
What I do is really simple, I just do
start = clock();
for (i=0;i<100;i++){
/* do something here */
}
stop = clock();
total = stop - start;
and then put the values of "start","stop" and "total" to a previously allocated shared memory with the ARM processor. Then I simply print it to the screen at the ARM side.
The problem is, in my first executes, I always get the same "total" value, and then in my next runs I always get 0! The "start" and "stop" values go along with the "total" value.
The strangest thing is that they seem to follow a bit pattern! I put the output below:
# ./sampleapp
Total = 63744
Start clock() value = 0x000000f9
Stop clock() value = 0x0000f9f9
# ./sampleapp
Total = 4177526784
Start clock() value = 0x00f9f9f9
Stop clock() value = 0xf9f9f9f9
# ./sampleapp
Total clock cyles = 0
Start clock() value = 0xf9f9f9f9
Stop clock() value = 0xf9f9f9f9
Apparantly, clock() is not functioning well, but I'm not sure if this is because of something I do wrong or because this type of thing is not supported with the hardware I have. Any ideas why this might be happening?
From reading the questions so far, I'd say the Original Poster has substantially more knowledge of this matter than the contributors so far, and that the suspicion that the clock() is broken (or not supported, and returns an undefined result) on the DSP seems quite likely.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With