From: Jeremy Fitzhardinge <jeremy@goop.org>
To: walmart <vmwalmart@gmail.com>
Cc: Dan Magenheimer <dan.magenheimer@oracle.com>,
xen-devel@lists.xensource.com
Subject: Re: Is there a way to get consistant time across different VMs?
Date: Tue, 07 Sep 2010 18:10:56 +1000 [thread overview]
Message-ID: <4C85F390.7070205@goop.org> (raw)
In-Reply-To: <AANLkTimn-67fkWaUno3m+Ndw=+Qm=FwcrYCRmoNNwx4U@mail.gmail.com>
On 09/07/2010 02:12 PM, walmart wrote:
> Hi, all:
>
> I want to test some program, which requires a high precise time. (some
> thing as rdtsc).
>
> I tested rdtsc on different VMs, they are not consistant. (I am using
> Xen 4.0, Fedora 13, 64 bit).
>
> Is there a way to get consistant high precise time across different VMs?
Hm, you're walking into a bit of a minefield.
What are your precise requirements for:
* accuracy
* resolution
* monotonicity
* cross-cpu synchronization
* cross-process synchronization
?
In general rdtsc isn't very useful as a timesource, since there are many
ways in which it can fail/do strange things from processor to processor
and system to system, so "s[a]me thing as rdtsc" doesn't tell us much.
However, in modern versions of Xen, you can turn on rdtsc emulation
which makes rdtsc generate a guaranteed global monotonic time value at a
nominal 1GHz rate (I think, or did that change to the starting CPU
speed?). But the downside is that it results in a trap'n'emulate of the
instruction which is a bit more expensive than a raw rdtsc.
Or if you have a new Intel system with a really, truly nonstop
synchronized tsc, you can use rdtsc directly.
But if neither of those are acceptable/possible, you need to use the
normal Xen system time, which has a 1ns resolution, is fairly precise,
but not generally completely monotonic between cpus. It also isn't
usable from usermode without some extra kernel patches.
J
next prev parent reply other threads:[~2010-09-07 8:10 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-09-07 4:12 Is there a way to get consistant time across different VMs? walmart
2010-09-07 8:10 ` Jeremy Fitzhardinge [this message]
2010-09-08 2:31 ` walmart
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=4C85F390.7070205@goop.org \
--to=jeremy@goop.org \
--cc=dan.magenheimer@oracle.com \
--cc=vmwalmart@gmail.com \
--cc=xen-devel@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.