All of lore.kernel.org
 help / color / mirror / Atom feed
* [Xenomai-help] Problem getting the time with a kernel patched with xenomai
@ 2010-05-06  7:52 Divi Oillo
  2010-05-06  8:15 ` Gilles Chanteperdrix
  0 siblings, 1 reply; 4+ messages in thread
From: Divi Oillo @ 2010-05-06  7:52 UTC (permalink / raw)
  To: xenomai

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

Hi, I post this message because I need a little help.

I've recently patched with success my 2.6.32.12 kernel with xenomai
adeos-ipipe-2.6.32.7-x86-2.6-01.patch and I've installed xenomai-2.5.2.
When I run this code on my linux-2.6.32.12 patched with xenomai, I'm getting
some trouble. The following code give the current time each second using
nanosleep and gettimeofday. The program wait 1 second and print the time in
the terminal.

************************************************************
#include <iostream>
#include <string>
#include <time.h>
#include <sys/time.h>
#include <unistd.h>

using namespace std;

int main (void)
{
        timeval timestamp;
        timeval timestamp_sav;
        struct timespec req;
        req.tv_sec=1; //1 second
        req.tv_nsec=0;
        double diff;

        while(1)
        {
                gettimeofday(&timestamp_sav,NULL);
                nanosleep(&req,&req);
                gettimeofday(&timestamp,NULL);

                diff = timestamp.tv_usec - timestamp_sav.tv_usec;
                cout << "timestamp_sav=" << timestamp_sav.tv_sec << "
timestamp=" << timestamp.tv_sec <<  "   Diff : " << diff << endl;
        }

        return 0;
}
************************************************************

uname -r
2.6.32-12-xenomai
../bin/timer
timestamp_sav=1273069305 timestamp=1273069306   Diff : 10010
timestamp_sav=1273069306 timestamp=1273069307   Diff : 10011
timestamp_sav=1273069307 timestamp=1273069308   Diff : 10011
timestamp_sav=1273069308 timestamp=1273069309   Diff : 10011
timestamp_sav=1273069309 timestamp=1273069310   Diff : 10011
timestamp_sav=1273069310 timestamp=1273069311   Diff : 10011
timestamp_sav=1273069311 timestamp=1273069312   Diff : 10010
timestamp_sav=1273069312 timestamp=1273069313   Diff : 10011
timestamp_sav=1273069313 timestamp=1273069314   Diff : 10011
timestamp_sav=1273069314 timestamp=1273069315   Diff : 10011

uname -r
2.6.32-12
../bin/timer
timestamp_sav=1273069885 timestamp=1273069886   Diff : 305
timestamp_sav=1273069886 timestamp=1273069887   Diff : 306
timestamp_sav=1273069887 timestamp=1273069888   Diff : 379
timestamp_sav=1273069888 timestamp=1273069889   Diff : 311
timestamp_sav=1273069889 timestamp=1273069890   Diff : 302
timestamp_sav=1273069890 timestamp=1273069891   Diff : 292
timestamp_sav=1273069891 timestamp=1273069892   Diff : 309
timestamp_sav=1273069892 timestamp=1273069893   Diff : 313
timestamp_sav=1273069893 timestamp=1273069894   Diff : 309
timestamp_sav=1273069894 timestamp=1273069895   Diff : 311


Why do I have +10010 µs or +10011 µs between each dating with my xenomai
kernel and approximately +300 µs with my non-patched kernel?
Thanks.

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

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

end of thread, other threads:[~2010-05-06 19:42 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-06  7:52 [Xenomai-help] Problem getting the time with a kernel patched with xenomai Divi Oillo
2010-05-06  8:15 ` Gilles Chanteperdrix
     [not found]   ` <i2kcfed72901005060830q1d29f948x4b558e2cf8cb617a@domain.hid>
2010-05-06 19:17     ` Gilles Chanteperdrix
2010-05-06 19:42       ` 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.