DSPRelated.com
Forums

Need some advice on DSP/BIOS timing. Any expert around?

Started by jari...@indra.es September 8, 2006
Hi dspers,

All what i need is someone who did that in the past. I have read plenty of things on the issue but no one solves my problem, and it could be because is very basic.

The thing is as follows: I want to measure the time my code takes in a real scenario, and so i use DSP/BIOS. I have configured the bios system clock to the on-chip timer0 (as default), and ive also created a log object. My application is based in a infinite loop with some interrupts coming up. I use CLK functions to obtain my code performance, but CLK_getltime() returns always zero as if the low resolution register never increments. Being sick of it, i decided to run this test code:

....
extern LOG_Obj log1;

main()
{

BIOS_start()
...

While(1)
{
LOG_printf(&log1, "PRD_getticks() %d\n", PRD_getticks());
LOG_printf(&log1, "CLK_getltime() %d\n", CLK_getltime());
LOG_printf(&log1, "CLK_gethtime() %d\n", CLK_gethtime());
LOG_printf(&log1, " CLK_countspms() %d\n", CLK_countspms());

my_code_to_be_profiled.....

IDL_run();
}
}
With this code, the log reports:

613468 PRD_getticks(): 0

613469 CLK_getltime(): 0

613470 CLK_gethtime(): 121594

613471 CLK_countspms(): 62500

613472 PRD_getticks(): 0

613473 CLK_getltime(): 0

613474 CLK_gethtime(): 122590

613475 CLK_countspms(): 62500

613476 PRD_getticks(): 0

613477 CLK_getltime(): 0

613478 CLK_gethtime(): 123589

613479 CLK_countspms(): 62500

613480 PRD_getticks(): 0

613481 CLK_getltime(): 0

613482 CLK_gethtime(): 124589

613483 CLK_countspms(): 62500

613484 PRD_getticks(): 0

613485 CLK_getltime(): 0

613486 CLK_gethtime(): 63087

613487 CLK_countspms(): 62500
.....
I do not know why CLK_getltime() returns always zero, and why CLK_gethtime() wraps back (Note the last value). With this, I can not measure any code since the low resolution register is not changing. Any idea?, any configuration that i should check?...
I am going crazy :( ,

Thanks!!!!
Jose
Jarizo-

Is this on CCS simulator? Or a real board?

When in confusion about internal timer based profiling, the thing to do is find an
external method. Toggle a GPIO line, turn on/off an LED, etc. Something that
changes state at the start of the processing loop, and *you can measure reliably*
with a digital scope.

Then you know whether something unexpected is happening. From where we stand, it
might be your chunk of code IDL_run() or interrupt routines that are messing up the
timer. How do we know. So the question is: as an engineer, how can you
definitively document what is really happening.

-Jeff

> All what i need is someone who did that in the past. I have read plenty
> of things on the issue but no one solves my problem, and it could be
> because is very basic.
>
> The thing is as follows: I want to measure the time my code takes in a
> real scenario, and so i use DSP/BIOS. I have configured the bios system
> clock to the on-chip timer0 (as default), and ive also created a log
> object. My application is based in a infinite loop with some interrupts
> coming up. I use CLK functions to obtain my code performance, but
> CLK_getltime() returns always zero as if the low resolution register
> never increments. Being sick of it, i decided to run this test code:
>
> ....
> extern LOG_Obj log1;
>
> main()
> {
>
> BIOS_start()
> ...
>
> While(1)
> {
> LOG_printf(&log1, "PRD_getticks() %d\n", PRD_getticks());
> LOG_printf(&log1, "CLK_getltime() %d\n", CLK_getltime());
> LOG_printf(&log1, "CLK_gethtime() %d\n", CLK_gethtime());
> LOG_printf(&log1, " CLK_countspms() %d\n", CLK_countspms());
>
> my_code_to_be_profiled.....
>
> IDL_run();
> }
>
> }
>
> With this code, the log reports:
>
> 613468 PRD_getticks(): 0
>
> 613469 CLK_getltime(): 0
>
> 613470 CLK_gethtime(): 121594
>
> 613471 CLK_countspms(): 62500
>
> 613472 PRD_getticks(): 0
>
> 613473 CLK_getltime(): 0
>
> 613474 CLK_gethtime(): 122590
>
> 613475 CLK_countspms(): 62500
>
> 613476 PRD_getticks(): 0
>
> 613477 CLK_getltime(): 0
>
> 613478 CLK_gethtime(): 123589
>
> 613479 CLK_countspms(): 62500
>
> 613480 PRD_getticks(): 0
>
> 613481 CLK_getltime(): 0
>
> 613482 CLK_gethtime(): 124589
>
> 613483 CLK_countspms(): 62500
>
> 613484 PRD_getticks(): 0
>
> 613485 CLK_getltime(): 0
>
> 613486 CLK_gethtime(): 63087
>
> 613487 CLK_countspms(): 62500
> .....
>
> I do not know why CLK_getltime() returns always zero, and why CLK_gethtime() wraps back (Note the last value). With this, I can not measure any code since the low resolution register is not changing. Any idea?, any configuration that i should check?...
> I am going crazy :( ,
>
> Thanks!!!!
> Jose