All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dirk Eibach <eibach@domain.hid>
To: Xenomai help <xenomai@xenomai.org>
Subject: [Xenomai-help] Xenomai degrades syscall time on PPC405
Date: Mon, 20 Aug 2007 14:11:08 +0200	[thread overview]
Message-ID: <46C984DC.6090203@domain.hid> (raw)

Hello,

I am trying to understand some performance problems I ran into on my 
xenomai system.

The testcode I attached performs a syscall(gettimeofday). Measuring time on 
a vanilla Kernel gives the following output:

ticks for ppc_getccounter: 116, for gettimeofday: 1479

The same kernel with xenomai patched in gives this:

ticks for ppc_getccounter: 116, for gettimeofday: 4278

Is this the expected behaviour? Why is the time for a system call nearly 3 
times as much?

#include <stdio.h>
#include <sys/time.h>
#include <time.h>

static void
ppc_getcounter(unsigned long long *v)
{
	register unsigned long tbu, tb, tbu2;

     loop:
	asm volatile ("mftbu %0" : "=r" (tbu) );
	asm volatile ("mftb  %0" : "=r" (tb)  );
	asm volatile ("mftbu %0" : "=r" (tbu2));
	if (__builtin_expect(tbu != tbu2, 0)) goto loop;

	/* The slightly peculiar way of writing the next lines is
	compiled better by GCC than any other way I tried. */
	((long*)(v))[0] = tbu;
	((long*)(v))[1] = tb;
}

int main(int argc, char* argv[])
{
	while(1) {
		struct timeval tv;
		unsigned long long count0, count1, count2;
		ppc_getcounter(&count0);
		ppc_getcounter(&count1);
		gettimeofday(&tv, NULL);
		ppc_getcounter(&count2);
		printf("ticks for ppc_getccounter: %lld, for gettimeofday: %lld\n",
			count1 - count0, count2- count1);
		sleep(1);
	}
}


Cheers
-- 
Dirk Eibach
Entwicklung
Guntermann & Drunck GmbH Systementwicklung





             reply	other threads:[~2007-08-20 12:11 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-08-20 12:11 Dirk Eibach [this message]
2007-08-23 20:45 ` [Xenomai-help] Xenomai degrades syscall time on PPC405 Philippe Gerum
2007-08-24  6:33   ` Dirk Eibach
2007-08-24  8:45     ` Philippe Gerum

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=46C984DC.6090203@domain.hid \
    --to=eibach@domain.hid \
    --cc=xenomai@xenomai.org \
    /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 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.