[Rtai] A strange problem in testing rtai

付言华 yanhwa.fu at gmail.com
Sat Dec 19 11:25:54 CET 2009


Hi all,
       Days ago, I have ported rtai-3.7.1 to ARM(at91sam9263), but I got a
strange problem when I tried to test its latency under load. Firstly, I run
the rtai kernel latency testsuit(../realtime/testsutie/kern/latency/run),
and there are output  information about latency. Then, while it running,
I start another process named "mem", whose function is to allocate and free
memory continuously. To my surprise, the latency becomes shorter instead of
longer when a load added. Could you tell me why? Thank you.

     The output before adding the process "mem":
============================================
 /usr/realtime/testsuite/kern/latency # ./run &
/usr/realtime/testsuite/kern/latency # *
*
* Type ^C to stop this application.
*
*
cat: can't open '/proc/modules': No such file or directory
I-pipe: Domain RTAI registered.
RTAI[hal]: <3.7.1> mounted over IPIPE-NOTHREADS 1.7-03.
RTAI[hal]: compiled with gcc version 3.4.1.
RTAI[hal]: mounted (IPIPE-NOTHREADS, IMMEDIATE (INTERNAL IRQs DISPATCHED).
PIPELINE layers:
bf0052a0 9ac15d93 RTAI 200
c026a3a0 0 Linux 100
RTAI[malloc]: global heap size = 131072 bytes, <BSD>.
RTAI[sched]: loaded (IMMEDIATE, UP, USER/KERNEL SPACE: <with RTAI OWN
KTASKs>, <
uses LINUX SYSCALLs>, kstacks pool size = 524288 bytes.
RTAI[sched]: hard timer type/freq = TIMER1/3104000(Hz); default timing:
periodic
; linear timed lists.
RTAI[sched]: Linux timer freq = 100 (Hz), TimeBase freq = 3104000 hz.
RTAI[sched]: timer setup = 1288 ns, resched latency = 4510 ns.
RTAI[usi]: enabled.
Warning: Error opening /proc/rtai/latency_calibrate
         Couldn't get infos about the module's state.
RTAI Testsuite - KERNEL latency (all data in nanoseconds)
RTH|    lat min|    ovl min|    lat avg|    lat max|    ovl max|   overruns
RTD|      16108|      16108|      22767|     277384|     277384|          0
RTD|      20940|      16108|      22352|      44780|     277384|          0
RTD|      20940|      16108|      22340|      55090|     277384|          0
RTD|      20940|      16108|      22354|      51868|     277384|          0
RTD|      20940|      16108|      22327|      48324|     277384|          0
RTD|      20940|      16108|      22363|      52190|     277384|          0
RTD|      21262|      16108|      22292|      40270|     277384|          0
RTD|      20940|      16108|      22368|      52835|     277384|          0
RTD|      13853|      13853|      22274|      37693|     277384|          0
RTD|      20940|      13853|      22292|      33182|     277384|          0
RTD|      21262|      13853|      22289|      41881|     277384|          0
RTD|      21262|      13853|      22346|      45425|     277384|          0
RTD|      21262|      13853|      22324|      50579|     277384|          0
RTD|      20940|      13853|      22363|      54445|     277384|          0
RTD|      20940|      13853|      22309|      33827|     277384|          0
RTD|      20940|      13853|      22369|      56056|     277384|          0
RTD|      20940|      13853|      22334|      51224|     277384|          0
RTD|      20618|      13853|      22335|      47036|     277384|          0
RTD|      20940|      13853|      22300|      44458|     277384|          0
RTD|      21262|      13853|      22383|      56378|     277384|          0
RTD|      20940|      13853|      22309|      44136|     277384|          0
RTH|    lat min|    ovl min|    lat avg|    lat max|    ovl max|   overruns
RTD|      20940|      13853|      22394|      48969|     277384|          0
========================================================

     The output after added the process "mem":
========================================================
1024B memory allocated OK!
1024B memory allocated OK!
1024B memory allocated OK!
1024B memory allocated OK!
1024B memory allocated OK!
RTD|       2899|       2899|      11737|      49935|     277384|          0
RTD|       2899|       2899|       4007|      20296|     277384|          0
RTD|       2899|       2899|       3775|      20618|     277384|          0
RTD|       2899|       2899|       3808|      19974|     277384|          0
RTD|       2899|       2899|       3783|      19974|     277384|          0
RTD|       2899|       2899|       3790|      20296|     277384|          0
RTH|    lat min|    ovl min|    lat avg|    lat max|    ovl max|   overruns
RTD|       2899|       2899|       3791|      19974|     277384|          0
RTD|       2899|       2899|       3797|      19974|     277384|          0
RTD|       2899|       2899|       3786|      19974|     277384|          0
RTD|       2899|       2899|       3815|      20296|     277384|          0
RTD|       2899|       2899|       3792|      20296|     277384|          0
RTD|       2899|       2899|       3796|      19974|     277384|          0
RTD|       2899|       2899|       3769|      20296|     277384|          0
RTD|       2899|       2899|       3802|      20296|     277384|          0
RTD|       2899|       2899|       3787|      20618|     277384|          0
RTD|       2899|       2899|       3800|      20296|     277384|          0
RTD|       2899|       2899|       3799|      19652|     277384|          0
RTD|       2899|       2899|       3800|      19974|     277384|          0
RTD|       2899|       2899|       3786|      20618|     277384|          0
RTD|       2899|       2899|       3793|      19974|     277384|          0
RTD|       2899|       2899|       3775|      19974|     277384|          0
RTD|       2899|       2899|       3829|      20296|     277384|          0
RTD|       2899|       2899|       3774|      19974|     277384|          0
RTD|       2899|       2899|       3815|      20296|     277384|          0
RTD|       2899|       2899|       3770|      20296|     277384|          0
RTD|       2899|       2899|       3799|      19974|     277384|          0
RTD|       2899|       2899|       3787|      20296|     277384|          0
RTH|    lat min|    ovl min|    lat avg|    lat max|    ovl max|   overruns
RTD|       2899|       2899|       3810|      20618|     277384|          0
===================================================

The code of process "mem":
======================
#include <stdio.h>
#include <stdlib.h>
#include <malloc.h>
int main(void)
{
        char *p;
        int cn=0;
        while(1)
        {
        p=(char*)malloc(1024);
        if(p)
        {
                if (cn<5) printf("1024B memory allocated OK!\n");
                cn++;
                if (cn>5)
                {
                        cn = 6;
                }
        }
        else
        {
                printf("Not enough Memory!\n");
        }
        free(p);
        }
        return 0;
}
===============================================================
Best regards,
Yanhua Fu,
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.rtai.org/pipermail/rtai/attachments/20091219/62512e40/attachment-0001.htm>


More information about the Rtai mailing list