From: Jeremy Fitzhardinge <jeremy@goop.org>
To: Marco Tizzoni <marco.tizzoni@gmail.com>
Cc: "Fajar A." <fajar@fajar.net>, Fasiha Ashraf <feehapk@yahoo.co.in>,
xen <xen-devel@lists.xensource.com>,
xen-users@lists.xensource.com
Subject: Re: Re: [Xen-users] About profiling xen
Date: Thu, 01 Oct 2009 13:54:04 -0700 [thread overview]
Message-ID: <4AC516EC.3050704@goop.org> (raw)
In-Reply-To: <f9611b0f0910010035m40949fb3o5efe60469b4466b7@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1671 bytes --]
On 10/01/09 00:35, Marco Tizzoni wrote:
> On Thu, Oct 1, 2009 at 1:23 AM, Jeremy Fitzhardinge <jeremy@goop.org> wrote:
>
>> Your clocksource is "xen", which is the best possible for a PV xen guest.
>>
>> However, a clocksource is for measuring elapsed time, not triggering
>> timers.
>>
> Why? How would you solve the problem of raising events at a fixed rate?
>
I'm not sure I follow you. In the kernel, the clock*source* subsystem
is for measuring time: its used to implement gettimeofday, as well as
internal time accounting. It isn't directly related to time events.
The clock*event* mechanism is all about setting up timers to raise events.
When running paravirtualized, we use Xen-specific versions of both.
>> Unfortunately there doesn't seem to be a /sys file to show the
>> current clockevent source in use, but if you have "xen" clocksource it's
>> almost certainly the xen clockevent.
>>
>> However, this is only relevent if you have CONFIG_NO_HZ and
>> CONFIG_HIGHRES_TIMERS enabled.
>>
> I've tried both set/unset but nothing change.
>
Hm. Its best to leave both enabled either way.
Try the attached program to get some info about how well timers are
working. Compile with:
$ gcc -o testtimer testtimer.c -O -lrt
And test various results:
$ ./testtimer .1 > xen-0.1.out
$ ./testtimer .01 > xen-0.01.out
$ ./testtimer .001 > xen-0.001.out
You can plot the results with:
$ gnuplot
gnuplot> plot "xen-0.001.out" with lines
The plot is delta from the expected time, so the ideal is that they all
be 0.
On my system in dom0 I see about 10% overhead at .001 and .0005 sec, so
the timers aren't being quantized to 100/250Hz.
J
[-- Attachment #2: testtimer.c --]
[-- Type: text/x-csrc, Size: 1033 bytes --]
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <sys/time.h>
#define SAMPLES 1000
static double samples[SAMPLES];
static const char prog[] = "/-\\|";
#define NS 1000000000
int main(int argc, char **argv)
{
int i, iter;
struct timespec start, end;
struct timespec sleep;
double base;
if (argc < 2)
base = .1;
else
base = strtod(argv[1], NULL);
iter = 20 / base;
if (iter > SAMPLES)
iter = SAMPLES;
fprintf(stderr, "%d iterations at %f sec\n", iter, base);
sleep.tv_sec = 0;
sleep.tv_nsec = base * NS;
while (sleep.tv_nsec >= NS) {
sleep.tv_sec++;
sleep.tv_nsec -= NS;
}
for(i = 0; i < iter; i++) {
double delta;
fprintf(stderr, "%c\b", prog[i % (sizeof(prog)-1)]);
clock_gettime(CLOCK_MONOTONIC, &start);
nanosleep(&sleep, NULL);
clock_gettime(CLOCK_MONOTONIC, &end);
delta = (end.tv_sec * NS + end.tv_nsec) -
(start.tv_sec * NS + start.tv_nsec);
samples[i] = delta - (base * NS);
}
for(i = 0; i < iter; i++)
printf("%f\n", samples[i] / NS);
return 0;
}
[-- Attachment #3: Type: text/plain, Size: 138 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
next prev parent reply other threads:[~2009-10-01 20:54 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-09-30 6:07 About profiling xen Fasiha Ashraf
2009-09-30 6:33 ` [Xen-users] " Marco Tizzoni
2009-09-30 6:37 ` Pasi Kärkkäinen
2009-09-30 6:40 ` Marco Tizzoni
2009-09-30 7:45 ` Marco Tizzoni
2009-09-30 9:06 ` [Xen-devel] " Marco Tizzoni
2009-09-30 14:21 ` Dan Magenheimer
2009-09-30 14:48 ` Re: [Xen-users] " Marco Tizzoni
2009-09-30 16:04 ` Dan Magenheimer
2009-09-30 16:38 ` Marco Tizzoni
2009-09-30 23:23 ` [Xen-devel] " Jeremy Fitzhardinge
2009-10-01 7:35 ` Marco Tizzoni
2009-10-01 20:54 ` Jeremy Fitzhardinge [this message]
2009-10-01 21:05 ` Marco Tizzoni
2009-10-01 21:16 ` Re: [Xen-users] " Jeremy Fitzhardinge
2009-10-01 21:26 ` Marco Tizzoni
2009-10-01 21:40 ` Jeremy Fitzhardinge
2009-10-01 21:55 ` [Xen-devel] " Marco Tizzoni
2009-10-01 22:01 ` Re: [Xen-users] " Jeremy Fitzhardinge
2009-10-01 22:20 ` Marco Tizzoni
2009-10-05 11:38 ` Fasiha Ashraf
2009-10-05 20:53 ` Jeremy Fitzhardinge
2009-10-06 5:01 ` [Xen-devel] " Fasiha Ashraf
2009-10-06 5:30 ` Re: [Xen-users] " Jeremy Fitzhardinge
2009-09-30 9:16 ` Fasiha Ashraf
2009-09-30 9:23 ` [Xen-devel] " Pasi Kärkkäinen
2009-10-01 3:41 ` Re: [Xen-users] " Fasiha Ashraf
2009-10-01 9:44 ` [Xen-devel] " Fasiha Ashraf
2009-09-30 23:19 ` Jeremy Fitzhardinge
2009-10-06 7:22 ` Fasiha Ashraf
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=4AC516EC.3050704@goop.org \
--to=jeremy@goop.org \
--cc=fajar@fajar.net \
--cc=feehapk@yahoo.co.in \
--cc=marco.tizzoni@gmail.com \
--cc=xen-devel@lists.xensource.com \
--cc=xen-users@lists.xensource.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.