5 #include <native/intr.h>
7 #include <native/task.h>
9 const RTIME period
= 1e5
;
10 const int nsamples
= 10000;
14 RTIME arr_write_time
[10000];
15 RTIME time_diff
[10000];
17 void do_task(void *arg
)
20 rt_task_set_periodic(NULL
, TM_NOW
, period
);
22 for(i
=0; i
<nsamples
; i
++)
24 write_time
= rt_timer_read();
25 arr_write_time
[i
] = write_time
;
27 rt_task_wait_period(NULL
);
29 time_diff
[i
] = rt_timer_read() - write_time
;
36 rt_task_create(&task
, NULL
,0,50,0);
37 rt_task_start(&task
, &do_task
, NULL
);
41 /* Avoids memory swapping for this program */
42 mlockall(MCL_CURRENT
|MCL_FUTURE
);
44 /* Perform auto-init of rt_print buffers if the task doesn't do so */
45 rt_print_auto_init(1);
48 int main(int argc
, char* argv
[])
50 printf("\nType CTRL-C to end this program\n\n" );
52 // code to set things to run xenomai
58 // wait for CTRL-c is typed to end the program