From: Wolfgang Mauerer <wolfgang.mauerer@siemens.com>
To: Stefan Weil <sw@weilnetz.de>
Cc: "aliguori@us.ibm.com" <aliguori@us.ibm.com>,
"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] [PATCH] Add option to slow down qemu
Date: Thu, 17 Jan 2013 18:14:19 +0100 [thread overview]
Message-ID: <50F8316B.6090101@siemens.com> (raw)
In-Reply-To: <50F06EF3.9070200@weilnetz.de>
On 11/01/13 20:58, Stefan Weil wrote:
> Am 11.01.2013 14:40, schrieb Wolfgang Mauerer:
>> > For slow targets and fast hosts, the emulation may be faster
>> > than the actual hardware, which can be undesirable for various
>> > reasons. Add a run-time option to slow down the emulation
>> > by sleeping in the CPU emulation.
>> >
>> > Signed-off-by: Wolfgang Mauerer<wolfgang.mauerer@siemens.com>
>> > ---
>> > cpus.c | 34 ++++++++++++++++++++++++++++++++++
>> > include/qemu-common.h | 2 ++
>> > qemu-options.hx | 13 +++++++++++++
>> > vl.c | 10 ++++++++++
>> > 4 files changed, 59 insertions(+), 0 deletions(-)
>> >
>> > diff --git a/cpus.c b/cpus.c
>> > index 4a7782a..41a9e0c 100644
>> > --- a/cpus.c
>> > +++ b/cpus.c
>> > @@ -106,6 +106,11 @@ static QEMUTimer *icount_warp_timer;
>> > static int64_t vm_clock_warp_start;
>> > static int64_t qemu_icount;
>> >
>> > +static double slowdown_factor = 0.0;
>> > +#ifndef _WIN32
>> > +static struct timespec slowdown_delay;
>> > +#endif
>> > +
>> >
> Hi,
>
> slowdown_delay is used in configure_slowdown unconditionally,
> so I don't expect that the _WIN32 case will compile.
>
> What about using g_usleep? It avoids the conditional compilation.
>
> Is the comparison of double value "slowdown_factor" with 0.0
> time critical, or do all QEMU platforms have a fast FPU?
>
> Setting a boolean value once and testing that value would
> be much faster of course.
I'm not sure if the floating point comparison has a significant
impact on any important platform, but using a boolean variable
makes the code more similar to the icount mechanism, so I've
changed it accordingly. Using g_usleep is a good idea to let the
conditional _WIN32 parts go away. Revised patch follows.
Cheers, Wolfgang
prev parent reply other threads:[~2013-01-17 17:10 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-11 13:40 [Qemu-devel] [PATCH] Add option to slow down qemu Wolfgang Mauerer
2013-01-11 19:58 ` Stefan Weil
2013-01-17 17:10 ` [Qemu-devel] [[PATCH v2]] Add option to slow qemu down Wolfgang Mauerer
2013-01-17 20:21 ` Stefan Weil
2013-01-18 12:04 ` Wolfgang Mauerer
2013-01-18 12:05 ` [Qemu-devel] [PATCH] " Wolfgang Mauerer
2013-05-07 9:12 ` [Qemu-devel] [[PATCH v2]] " Wolfgang Mauerer
2013-05-07 10:56 ` Markus Armbruster
2013-05-07 11:30 ` Wolfgang Mauerer
2013-01-17 17:14 ` Wolfgang Mauerer [this message]
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=50F8316B.6090101@siemens.com \
--to=wolfgang.mauerer@siemens.com \
--cc=aliguori@us.ibm.com \
--cc=qemu-devel@nongnu.org \
--cc=sw@weilnetz.de \
/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.