[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
BOUNCE rtl@rtlinux.org: Approval required: Non-member submissionfrom [Thomas Lehwald <thomas.lehwald@Ruetz.de>] (fwd)
- To: rtl@rtlinux.org
- Subject: BOUNCE rtl@rtlinux.org: Approval required: Non-member submissionfrom [Thomas Lehwald <thomas.lehwald@Ruetz.de>] (fwd)
- From: Der Herr Hofrat <der.herr@hofr.at>
- Date: Thu, 31 May 2001 07:20:43 +0200 (CEST)
>From owner-rtl Wed May 30 06:20:13 2001
Received: from central.webforum.de (central.webforum.de [193.141.169.166])
by hq.fsmlabs.com (8.11.2/8.11.2) with ESMTP id f4UCKCs00653
for <rtl@fsmlabs.com>; Wed, 30 May 2001 06:20:12 -0600
Received: (from smap@localhost) by central.webforum.de (8.7.6/8.7.6-webforum) id OAA30369 for <rtl@fsmlabs.com>; Wed, 30 May 2001 14:15:01 +0200
Received: from exchange.ruetz.de(192.168.53.2)
via SMTP by central.webforum.de, id smtpda30365; Wed May 30 12:14:45 2001
Received: by EXCHANGE with Internet Mail Service (5.5.2448.0)
id <KQPB6WJG>; Wed, 30 May 2001 14:08:04 +0200
Message-ID: <5194C7501DC8D311A7DA00C0F015DD9111FCBE@EXCHANGE>
From: Thomas Lehwald <thomas.lehwald@Ruetz.de>
To: rtl@fsmlabs.com
Subject: misbehavior of rtl_printf()
Date: Wed, 30 May 2001 14:07:59 +0200
MIME-Version: 1.0
X-Mailer: Internet Mail Service (5.5.2448.0)
Content-Type: text/plain;
charset="iso-8859-1"
Hi all,
I have an additional test performed: The conditions and the result are
below. The "Diff" is that, that I expect, but whats about the doubled output
of the same variable (t1 and t2)??. Depends this on the %Ld formatter ????
I'm not sure. Has anybody an explanation for this?? In addition seen the
negative output (section DMESG).
Thanks
Thomas
------------------ Module Code -------------------------
#include <rtl.h>
#include <time.h>
#include <pthread.h>
static pthread_t thread;
static void * start_routine(void *arg)
{
int i;
hrtime_t t1;
hrtime_t t2;
hrtime_t diff;
struct sched_param p;
p . sched_priority = 1;
pthread_setschedparam (pthread_self(), SCHED_FIFO, &p);
rtl_printf("RTLinux thread starts on CPU%d\n", rtl_getcpuid());
for (i = 0; i < 100; i++) {
t1 = gethrtime();
rtl_printf("Before Sleep: gethrtime()=[%Ld][%Ld]\n", t1,t1);
usleep(500000);
t2 = gethrtime();
rtl_printf("After Sleep: gethrtime()=[%Ld][%Ld]\n", t2,t2);
diff = t2 - t1;
rtl_printf("Diff=[%Ld]\n", diff);
}
return (void *) 0;
}
int init_module(void)
{
int ret;
pthread_attr_t attr;
pthread_attr_init (&attr);
ret = pthread_create (&thread, &attr, start_routine, 0);
if (ret) {
rtl_printf("failed to create a thread\n");
return ret;
}
return 0;
}
void cleanup_module(void)
{
pthread_delete_np (thread);
}
-------------- Makefile -------------------------------
ALL= test.o
CC = gcc
USER_CFLAGS = -O2 -Wall
RTL_FLAGS = `rtl-config --cflags`
RTL_INCL = /usr/include/rtlinux
all : $(ALL)
test.o: test.c
$(CC) -c $(RTL_FLAGS) -I$(RTL_INCL) $<
clean:
rm -f *.o
---------------- DMESG Output -------------------------------
RTLinux thread starts on CPU0
Before Sleep: gethrtime()=[1342973024][823]
After Sleep: gethrtime()=[1842995584][823]
Diff=[500022560]
Before Sleep: gethrtime()=[1843014144][823]
After Sleep: gethrtime()=[-1951933984][823]
Diff=[500019168]
Before Sleep: gethrtime()=[-1951919584][823]
After Sleep: gethrtime()=[-1451899328][823]
Diff=[500020256]
Before Sleep: gethrtime()=[-1451883744][823]
After Sleep: gethrtime()=[-951864864][823]
Diff=[500018880]
Before Sleep: gethrtime()=[-951849792][823]
After Sleep: gethrtime()=[-451824448][823]
Diff=[500025344]
Before Sleep: gethrtime()=[-451803584][823]
After Sleep: gethrtime()=[48217120][824]
Diff=[500020704]
Before Sleep: gethrtime()=[48235104][824]
After Sleep: gethrtime()=[548257280][824]
Diff=[500022176]
----------------------------------------------------------------------------
------
**************************************************************
Dipl.-Ing. (FH)
Thomas Lehwald
RUETZ Technologies Tel: 089 / 3 56 10 - 268
Abteilung E-Technik Fax: 089 / 3 56 10 - 111
Ingolstaedter Strasse 18 80807 Muenchen
email: thomas.lehwald@ruetz.de
****************************************************