From: Luiz Capitulino <lcapitulino@redhat.com>
To: linux-rt-users@vger.kernel.org
Cc: Marcelo Tosatti <mtosatti@redhat.com>,
williams@redhat.com, riel@redhat.com
Subject: cyclictest abstime vs. reltime
Date: Wed, 17 Dec 2014 15:16:50 -0500 [thread overview]
Message-ID: <20141217151650.6ee5649c@redhat.com> (raw)
Hello,
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? This is so because we have fixed sleeping points which
don't take into consideration the sleeping latency nor the bunch of
things the timerthread does (eg. update histogram).
If I'm making sense, won't this behavior cause better numbers to be
reported?
I compared abstime and reltime in bare-metal, and got the following
results (cyclictest [-r] -m -n -q -p99 -l 1000000):
abstime mode:
# Min Latencies: 00001
# Avg Latencies: 00001
# Max Latencies: 00003
reltime mode:
# Min Latencies: 00003
# Avg Latencies: 00003
# Max Latencies: 00008
(Yes, this machine is pretty modern and well setup for RT. The results
above are pretty deterministic. Also, I've ran hwaltdetect for hours
and got no SMIs).
The relative time algorithm, on the other hand, is exactly what I expected
I would see when I looked at the code:
/* do some quick stuff */
while() {
clock_getttime(&now)
clock_nanosleep(&interval) /* interval == 1000us */
expected = now + interval
clock_getttime(&now)
diff = calcdiff(now, expected);
/* update a bunch of stats and the histogram data, also
check if we're finished */
}
So, my question boils down to: is there a relevant difference between
the two modes? Why isn't reltime the default mode?
next reply other threads:[~2014-12-17 20:16 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-12-17 20:16 Luiz Capitulino [this message]
2014-12-18 8:22 ` cyclictest abstime vs. reltime Uwe Kleine-König
2014-12-18 10:04 ` John Ogness
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=20141217151650.6ee5649c@redhat.com \
--to=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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).