[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
BOUNCE rtl@rtlinux.org: Approval required: Non-member submissionfrom ["Jonas Persson" <jonas.persson@comsys.se>] (fwd)
- To: rtl@rtlinux.org
- Subject: BOUNCE rtl@rtlinux.org: Approval required: Non-member submissionfrom ["Jonas Persson" <jonas.persson@comsys.se>] (fwd)
- From: Der Herr Hofrat <der.herr@hofr.at>
- Date: Tue, 15 May 2001 20:26:39 +0200 (CEST)
>From owner-rtl Tue May 15 10:51:20 2001
Received: from ideon.se (iris.ideon.se [193.45.79.9])
by hq.fsmlabs.com (8.11.2/8.11.2) with ESMTP id f4FGpC508966
for <rtl@fsmlabs.com>; Tue, 15 May 2001 10:51:17 -0600
Received: by ideon.se from localhost
(router,SLMail V2.6); Tue, 15 May 2001 18:46:09 +0200
Received: by ideon.se from zeta
(194.237.138.68::mail daemon; unverified,SLMail V2.6); Tue, 15 May 2001 18:46:08 +0200
From: "Jonas Persson" <jonas.persson@comsys.se>
To: "RTLinux Mailing list" <rtl@fsmlabs.com>
Subject: Timing question
Date: Tue, 15 May 2001 18:44:16 +0200
Message-ID: <GBEBJEDLOFFHLCHJLHDLGEKDCDAA.jonas.persson@comsys.se>
MIME-Version: 1.0
Content-Type: text/plain;
charset="iso-8859-15"
X-Priority: 3 (Normal)
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0)
Importance: Normal
In-Reply-To:
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400
Content-Transfer-Encoding: 8bit
X-MIME-Autoconverted: from quoted-printable to 8bit by hq.fsmlabs.com id f4FGpK508967
Hi,
I'm measuring the timing of my (RT-) processes using gethrtime(). Basically, the timing loop looks like this:
hrtime_t a,b,c;
pthread_make_periodic_np(pthread_self(),gethrtime(), periodicity);
while (1)
{
a = gethrtime();
pthread_wait_np();
b = gethrtime();
// do something useful
c = gethrtime();
// send a,b,c to user space via RTfifo
}
When comparing (b-a), which should be the time between context-switch-out and switch-in, I am getting unreasonable values - 42806400 ns - no matter how i set the period time of the process. I have tried with a very slow 99 Hz and a more reasonable 9900 Hz, the results are the same... what is happening here?
I am running this on an SMP machine, albeit only with one processor (866MHz PIII). gethrtimeres() reports 32. The linux kernel is compiled for SMP, so I guess an APIC is used for timing.
I tried to read the TSC with the following piece of code,
extern __inline__ unsigned long long int get_rdtsc()
{
unsigned long long int x;
__asm__ __volatile__ (".byte 0x0f, 0x31" : "=A" (x)) ;
return x;
}
but I get even more bogus values using that. Is the TSC reset by linux or rtlinux during for example scheduling?
Regards, Jonas
______________________________________________________________________
Jonas Persson E-mail: jonas.persson@comsys.se
Project Manager, M.Sc C.Sc&E http://www.comsys.se/
Comsys AB Phone: +46-(0)46-286 3500
Forskningsbyn IDEON Fax: +46-(0)46-286 3505
S-223 70 Lund, Sweden