All of lore.kernel.org
 help / color / mirror / Atom feed
From: John Ogness <john.ogness@linutronix.de>
To: Luiz Capitulino <lcapitulino@redhat.com>
Cc: linux-rt-users@vger.kernel.org,
	Marcelo Tosatti <mtosatti@redhat.com>,
	williams@redhat.com, riel@redhat.com
Subject: Re: cyclictest abstime vs. reltime
Date: Thu, 18 Dec 2014 11:04:38 +0100	[thread overview]
Message-ID: <87fvcd9suh.fsf@linutronix.de> (raw)
In-Reply-To: <20141217151650.6ee5649c@redhat.com> (Luiz Capitulino's message of "Wed, 17 Dec 2014 15:16:50 -0500")

On 2014-12-17, Luiz Capitulino <lcapitulino@redhat.com> wrote:
> We're doing some scheduling latency measurements with KVM. While
> analyzing some traces and reading cyclictest code in the process, I
> found out that by default cyclictest uses the absolute time algorithm,
> which basically does:
>
> clock_gettime(&now)
> next = now + interval   /* interval == 1000us */
> /* do some quick stuff */
> while() {
>     clock_nanosleep(&next) /* ie. sleeps until now + 1000us, 'next' is abs */
>     clock_gettime(&now)
>     diff = calcdiff(now, next)
>     /* update a bunch of stats and the histogram data, also
>        check if we're finished */
>     next += interval
> }
>
> Now, doesn't this mean that the timerthread will actually sleep less
> than interval?

Correct. In cyclictest you are not specifying sleep time. You are
specifing the wake interval.

> This is so because we have fixed sleeping points which don't take into
> consideration the sleeping latency

Sleep latency is taken into account. That is exactly what cyclictest
measures.

> nor the bunch of things the timerthread does (eg. update histogram).

cyclictest does not (and should not) care about this.

> If I'm making sense, won't this behavior cause better numbers to be
> reported?

Using _relative_ mode causes _worse_ numbers to be reported because it
assumes that a new relative time can be prepared and set
instantaneously, which is not correct. So you are not only measuring
sleep latency, but also mixing in timer setup duration. I think these
numbers would be misleading, since I would expect real-world RT projects
to be using absolute time.

Absolute (and relative) mode mixes in timer interrupt handling
duration. But that is appropriate here since we are not only interested
in how good the hardware timer is, but also how fast PREEMPT_RT can
allow software to respond to it.

John Ogness

  parent reply	other threads:[~2014-12-18 10:04 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-17 20:16 cyclictest abstime vs. reltime Luiz Capitulino
2014-12-18  8:22 ` Uwe Kleine-König
2014-12-18 10:04 ` John Ogness [this message]
2014-12-18 14:33   ` Luiz Capitulino

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=87fvcd9suh.fsf@linutronix.de \
    --to=john.ogness@linutronix.de \
    --cc=lcapitulino@redhat.com \
    --cc=linux-rt-users@vger.kernel.org \
    --cc=mtosatti@redhat.com \
    --cc=riel@redhat.com \
    --cc=williams@redhat.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 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.