mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ingo Molnar <mingo@elte.hu>
To: tike64 <tike64@yahoo.com>
Cc: Steven Rostedt <rostedt@goodmis.org>,
	linux-kernel@vger.kernel.org,
	Thomas Gleixner <tglx@linutronix.de>
Subject: Re: realtime-preempt and arm
Date: Fri, 15 Dec 2006 10:58:14 +0100	[thread overview]
Message-ID: <20061215095814.GA29368@elte.hu> (raw)
In-Reply-To: <20061215071541.35583.qmail@web59204.mail.re1.yahoo.com>


* tike64 <tike64@yahoo.com> wrote:

> I made my test code visible if you want to take a look: www dot
> riihineva dot no-ip dot org uphill public uphill test-rt.c

on x86, with nanosleep i get:

 # ./test-rt
 100 revs; min: 5026 max: 5099 avg: 5062
 100 revs; min: 5031 max: 5105 avg: 5065
 100 revs; min: 5021 max: 5096 avg: 5048
 100 revs; min: 5014 max: 5080 avg: 5041
 100 revs; min: 5015 max: 5072 avg: 5040
 100 revs; min: 5018 max: 5075 avg: 5041
 100 revs; min: 5021 max: 5091 avg: 5042

with select i get:

 # ./test-rt
 100 revs; min: 4276 max: 6048 avg: 5181
 100 revs; min: 4371 max: 6060 avg: 5438
 100 revs; min: 4409 max: 6056 avg: 5338
 100 revs; min: 4940 max: 6056 avg: 5468
 100 revs; min: 4938 max: 6049 avg: 5398
 100 revs; min: 4373 max: 6056 avg: 5279
 100 revs; min: 4943 max: 6040 avg: 5068

(HZ=250 on this kernel)

so these results look pretty normal to me. Modified code attached below. 
(Change the '#if 1' to '#if 0' to get the select() measurement.)

	Ingo

----------------->
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <limits.h>
#include <sched.h>
#include <time.h>
#include <sys/time.h>
#include <sys/mman.h>

static unsigned raw_timer(void)
{
	struct timeval tv;

	gettimeofday(&tv, 0);

	return tv.tv_sec * 1000000 + tv.tv_usec;
}

int main(int argc, char *argv[])
{
	int t, min_t = INT_MAX, max_t = INT_MIN, avg_t = 0, n = 0;
	struct timespec ts;
	struct timeval tv;
	struct sched_param prio;

	prio.sched_priority = 99;
	if (sched_setscheduler(0, SCHED_RR, &prio) < 0) {
		perror("setscheduler failed"); }
	if (mlockall(MCL_CURRENT | MCL_FUTURE) < 0) {
		perror("mlockall failed"); }
	while (1) {
		t = raw_timer();

		ts.tv_nsec = 5000000;
		ts.tv_sec = 0;
#if 1
		nanosleep(&ts, 0);
#else
		tv.tv_usec = 5000;
		tv.tv_sec = 0;
		select(0, 0, 0, 0, &tv);
#endif
		t = raw_timer() - t;
		if (max_t < t) max_t = t;
		if (min_t > t) min_t = t;
		avg_t += t;
		++n;
		if (n < 100)
			continue;
		printf("%i revs; min: %i max: %i avg: %i\n", n, min_t, max_t, (avg_t + n / 2) / n);
		fflush(stdout);
		min_t = INT_MAX;
		max_t = INT_MIN;
		avg_t = 0;
		n = 0;
	}
}


  reply	other threads:[~2006-12-15 10:00 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-11-29  8:57 tike64
2006-11-30 15:56 ` junjiec
2006-12-01  9:07   ` tike64
2006-12-13 18:36     ` Steven Rostedt
2006-12-14  7:21       ` tike64
2006-12-14 10:00         ` Ingo Molnar
2006-12-14 10:26           ` tike64
2006-12-14 12:52             ` Steven Rostedt
2006-12-14 14:23               ` tike64
2006-12-14 15:20                 ` Steven Rostedt
2006-12-15  7:15                   ` tike64
2006-12-15  9:58                     ` Ingo Molnar [this message]
2006-12-15 13:00                       ` Steven Rostedt
2006-12-16  0:14 Robert Crocombe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20061215095814.GA29368@elte.hu \
    --to=mingo@elte.hu \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rostedt@goodmis.org \
    --cc=tglx@linutronix.de \
    --cc=tike64@yahoo.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome