MIME-Version: 1.0 Date: Fri, 30 Apr 2010 16:39:05 +0200 Message-ID: From: Leyrit Vincent Content-Type: multipart/alternative; boundary=00151747b46e7dfef00485753464 Subject: [Xenomai-help] help with porting simple posix application List-Id: Help regarding installation and common use of Xenomai List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: xenomai@xenomai.org --00151747b46e7dfef00485753464 Content-Type: text/plain; charset=ISO-8859-1 Hello, i would like to port a POSIX application on XENOMAI .. i have try a very simple test to verify the xenomai functionnalities ... a thread call a recursive funtion which call clock_gettime() ... this thread is set with a SCHED_FIFO and has a priority of 10 ... the binary is well linked with the xenomail pthread_rt library (in makefile i have used xeno-config with posix sking and cflags / ldflags) when i execute the binary , i take a look on the /proc/xenomai/sched and i see that my thread is set as X 'related shadow' i think it is a problem? For my opinion the flag show that my thread swich many time from the Xenomai domain to the Linux domain ... Does someone can help me if my simple code is false? Thanks for help... Alexandre... (xenomai ) xeno-info : xenomai 2.5.2 (kernel 2.6.32.11 | ipipe 2.6-03) CODE ----------------------------------------------------------------------- int recursive_method(int cp) { struct timeval ta; struct timespec ts_start, ts_end; if(cp < n_recurs) { for(int i=0; i < 10;i++) { clock_gettime(CLOCK_REALTIME,&ts_start); xnprintf("%d\n", ts_start.tv_nsec); } recursive_method(cp++); } } void *producer(void *) { recursive_method(1); return 0; } int xeno_user_init() { struct sched_param parm; pthread_attr_t attr; int rc = 0, fd = -1; struct sigevent evt; pthread_attr_init(&attr); pthread_attr_setinheritsched(&attr, 1); pthread_attr_setschedpolicy(&attr, SCHED_FIFO); parm.sched_priority = 10; pthread_attr_setschedparam(&attr, &parm); rc = pthread_create(&producer_task, &attr, &producer, NULL); if (rc) { xnprintf("pthread_create(producer_task): %d\n", rc); } return rc; } int main (int ac, char *av[]) { int rc, sig; mlockall(MCL_CURRENT|MCL_FUTURE); rc = xeno_user_init(); return 0; } CODE ----------------------------------------------------------------------- --00151747b46e7dfef00485753464 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Hello,

i would like to port a POSIX application on XENOMAI ..
i h= ave try a very simple test to verify the xenomai functionnalities ...
a = thread call a recursive funtion which call clock_gettime() ...
this thre= ad is set with a SCHED_FIFO and has a priority of 10 ...

the binary is well linked with the xenomail pthread_rt library (in make= file i have used xeno-config with posix sking and cflags / ldflags)

= when i execute the binary , i take a look on the /proc/xenomai/sched and i = see that my thread is set as X 'related shadow'
i think it is a problem? For my opinion the flag show that my thread swich = many time from the Xenomai domain to the Linux domain ...

Does someo= ne can help me if my simple code is false?
Thanks for help...

Alexandre... (xenomai )

xeno-info : xenomai 2.5.2 (kernel 2.6.32.11 = | ipipe 2.6-03)

CODE -----------------------------------------------= ------------------------

int recursive_method(int cp)
{
=A0 st= ruct timeval ta;
=A0 struct timespec ts_start, ts_end;

=A0 if(cp < n_recurs)
= =A0=A0=A0 {
=A0=A0=A0=A0=A0 for(int i=3D0; i < 10;i++)
=A0=A0=A0= =A0=A0=A0=A0 {
=A0=A0=A0=A0=A0=A0=A0=A0=A0 clock_gettime(CLOCK_REALTIME,= &ts_start);
=A0=A0=A0=A0=A0=A0=A0=A0=A0 xnprintf("%d\n", t= s_start.tv_nsec);
=A0=A0=A0=A0=A0=A0=A0 }
=A0=A0=A0=A0=A0 recursive_method(cp++);
=A0= =A0=A0 }
}


void *producer(void *)
{
=A0 recursive_metho= d(1);
=A0 return 0;
}

int xeno_user_init()
{
=A0 struct = sched_param parm;
=A0 pthread_attr_t attr;
=A0 int rc =3D 0, fd =3D -1;
=A0 struct sigevent evt;

=A0 pthread= _attr_init(&attr);
=A0 pthread_attr_setinheritsched(&attr, 1);=A0 pthread_attr_setschedpolicy(&attr, SCHED_FIFO);
=A0 parm.sched= _priority =3D 10;
=A0 pthread_attr_setschedparam(&attr, &parm);

=A0 rc =3D pth= read_create(&producer_task, &attr, &producer, NULL);

=A0= if (rc)
=A0=A0=A0 {
=A0=A0=A0=A0=A0 xnprintf("pthread_create(pr= oducer_task): %d\n", rc);
=A0=A0=A0 }
=A0 return rc;
}

int main (int ac, char *av[])
= {
=A0 int rc, sig;
=A0 mlockall(MCL_CURRENT|MCL_FUTURE);

=A0 r= c =3D xeno_user_init();
=A0 return 0;
}

CODE -----------------= ------------------------------------------------------

--00151747b46e7dfef00485753464--