All of lore.kernel.org
 help / color / mirror / Atom feed
* [Xenomai-help] Xenomai App question
@ 2008-06-19 14:23 Breno Carneiro Pinheiro
       [not found] ` <485E6AC6.9070005@domain.hid>
  0 siblings, 1 reply; 3+ messages in thread
From: Breno Carneiro Pinheiro @ 2008-06-19 14:23 UTC (permalink / raw)
  To: xenomai

[-- Attachment #1: Type: text/plain, Size: 2627 bytes --]

 Hi all,

I'm implementing  an predictive control application to run on my powerpc
(MPC5200 - 400Mhz) with Xenomai patch. Now that I have it done, I wonder
estimate the computation time of some parts in my code.
I trying to use the Native/Xenomai API to get it but the results are weirds.
My task code is below:


void Simulator (void* c)
{

    unsigned char n;
    unsigned long overrun;
    FILE *stream;
    unsigned int i;

    float v, t;
    n    = 20;
    v    = (float) V;
    t    = (float) T;
    alfa = (float) sqrt(29);
    stream = fopen("time.dat", "w+t"); // where I print the results



    for(i=na_mfd;i<nref;i++)
    {
        *infoTempo = rt_timer_ticks2ns(rt_timer_read());
       fprintf(stream, "%lld\n",infoTempo);*

       // ------------- My control Code ---------------//
        x_sys[i]    = (float) (x_sys[i-1] + V*cos(teta_sys[i-1]+fi[i-1])*T);

        y_sys[i]    = (float) (y_sys[i-1] + V*sin(teta_sys[i-1]+fi[i-1])*T);

        teta_sys[i] = (float) (teta_sys[i-1] + (V*sin(fi[i-1])*T)/LE);
        y[0] = x_sys[i-1];
        y[1] = y_sys[i-1];
        abs2local(&y[0], &y[1], &x_sys[i], &y_sys[i], &teta_sys[i]);
        y[0] = teta_sys[i];
        purePursuit(r, &x_sys[i], &y_sys[i], &teta_sys[i], xref, yref, &n,
&nref, &alfa, &dg, &t, &v);
        processFreeResponseOP(R, B, f, y, du, h, na_mfd, nb_mfd, nout, nin);

        processCommand(K, r, f, du, 0, h, na_mfd, nb_mfd, nout, nin, n);
        #ifdef DEBUG
        printArray(f, TAILREF, "Resposta Livre:");
        printArray(du, nb_mfd*nin, "du:");
        #endif
        fi[i] = fi[i-1] + du[nb_mfd-1];
        infoTempo = rt_timer_ticks2ns(rt_timer_read());

//------------------------------------------------------------------------------//


    }
    fclose(stream);

}

That's the only one task I have on my system. I wonder compute the time to
process every single step of *for* loop. What you think?

Besides this, I'm looking some documents that say:

The selection
of the proper operation mode (oneshot or periodic) of the timer is made at
build time using the configuration switch
named *CONFIG_XENO_OPT_TIMING_PERIOD* from the nucleus section. A
zero value causes the native skin to operate in oneshot mode; otherwise,
periodic
mode is used according to the given duration of the clock tick, expressed in
nanoseconds. If support for periodic timing has been disabled at
configuration
level (i.e. *CONFIG_XENO_OPT_TIMING_PERIODIC* is unset), the timer mode
always defaults to oneshot.

What is *CONFIG_XENO_OPT_TIMING_PERIOD*? And where configure it?

I hope someone have some time for that.

Thanks a lot,

Breno
*
*

[-- Attachment #2: Type: text/html, Size: 4072 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Xenomai-help] Xenomai App question
       [not found] ` <485E6AC6.9070005@domain.hid>
@ 2008-06-22 19:37   ` Breno Carneiro Pinheiro
  2008-06-22 19:46     ` Gilles Chanteperdrix
  0 siblings, 1 reply; 3+ messages in thread
From: Breno Carneiro Pinheiro @ 2008-06-22 19:37 UTC (permalink / raw)
  To: Gilles Chanteperdrix, xenomai

[-- Attachment #1: Type: text/plain, Size: 1834 bytes --]

Thanks Gilles. On my system I have:

*include/config/auto.conf:CONFIG_XENO_OPT_TIMING_PERIODIC=y
include/linux/autoconf.h:#define CONFIG_XENO_OPT_TIMING_PERIODIC 1*

Is that correctly set? I wanna run periodic tasks and my processor's clock
is 400Mhz. Which is the best config.?

Thanks again,

Breno

2008/6/22 Gilles Chanteperdrix <gilles.chanteperdrix@xenomai.org>:

> Breno Carneiro Pinheiro wrote:
>
>>  Hi all,
>>
>> I'm implementing  an predictive control application to run on my powerpc
>> (MPC5200 - 400Mhz) with Xenomai patch. Now that I have it done, I wonder
>> estimate the computation time of some parts in my code.
>> I trying to use the Native/Xenomai API to get it but the results are
>> weirds.
>> My task code is below:
>>
>
> The simple way to estimate the computation time of some parts of the code
> is:
>
> unsigned long long start, end;
>
> some code 1
> start = rt_timer_tsc();
> some code 2
> end = rt_timer_tsc();
>
> To get the duration of "some code 2", compute:
> rt_timer_tsc2ns(end - start)
>
>  Besides this, I'm looking some documents that say:
>>
>> The selection
>> of the proper operation mode (oneshot or periodic) of the timer is made at
>> build time using the configuration switch
>> named *CONFIG_XENO_OPT_TIMING_PERIOD* from the nucleus section. A
>> zero value causes the native skin to operate in oneshot mode; otherwise,
>> periodic
>> mode is used according to the given duration of the clock tick, expressed
>> in
>> nanoseconds. If support for periodic timing has been disabled at
>> configuration
>> level (i.e. *CONFIG_XENO_OPT_TIMING_PERIODIC* is unset), the timer mode
>> always defaults to oneshot.
>>
>> What is *CONFIG_XENO_OPT_TIMING_PERIOD*? And where configure it?
>>
>
> In the kernel configuration menu.
>
>
> --
>
>
>                                            Gilles.
>

[-- Attachment #2: Type: text/html, Size: 2689 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Xenomai-help] Xenomai App question
  2008-06-22 19:37   ` Breno Carneiro Pinheiro
@ 2008-06-22 19:46     ` Gilles Chanteperdrix
  0 siblings, 0 replies; 3+ messages in thread
From: Gilles Chanteperdrix @ 2008-06-22 19:46 UTC (permalink / raw)
  To: Breno Carneiro Pinheiro; +Cc: xenomai

Breno Carneiro Pinheiro wrote:
> Thanks Gilles. On my system I have:
> 
> *include/config/auto.conf:CONFIG_XENO_OPT_TIMING_PERIODIC=y
> include/linux/autoconf.h:#define CONFIG_XENO_OPT_TIMING_PERIODIC 1*
> 
> Is that correctly set? I wanna run periodic tasks and my processor's clock
> is 400Mhz. Which is the best config.?

Read the help about this option in the Kernel configuration menu. It 
will tell you all you need to know.

-- 


					    Gilles.


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-06-22 19:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-06-19 14:23 [Xenomai-help] Xenomai App question Breno Carneiro Pinheiro
     [not found] ` <485E6AC6.9070005@domain.hid>
2008-06-22 19:37   ` Breno Carneiro Pinheiro
2008-06-22 19:46     ` Gilles Chanteperdrix

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.