From: Takuya Yoshikawa <takuya.yoshikawa@gmail.com>
To: Avi Kivity <avi@redhat.com>
Cc: mtosatti@redhat.com, kvm@vger.kernel.org
Subject: Re: [RFC kvm-unit-tests] api: Add dirty logging performance test
Date: Sun, 8 Jan 2012 23:49:25 +0900 [thread overview]
Message-ID: <20120108234925.f3cd34c9ead6ad9c3e07b980@gmail.com> (raw)
In-Reply-To: <4F09A654.6020408@redhat.com>
On Sun, 08 Jan 2012 16:21:08 +0200
Avi Kivity <avi@redhat.com> wrote:
> On 01/08/2012 03:58 PM, Takuya Yoshikawa wrote:
> > Check how long it takes to get dirty log according to the number of
> > dirty pages, like:
> >
> > get dirty log: 49 us for 1 dirty pages
> > get dirty log: 49 us for 2 dirty pages
> > get dirty log: 45 us for 4 dirty pages
> > get dirty log: 41 us for 8 dirty pages
> > get dirty log: 40 us for 16 dirty pages
> > get dirty log: 44 us for 32 dirty pages
> > get dirty log: 39 us for 64 dirty pages
> > get dirty log: 42 us for 128 dirty pages
> > get dirty log: 45 us for 256 dirty pages
> > get dirty log: 53 us for 512 dirty pages
> > get dirty log: 72 us for 1024 dirty pages
> > get dirty log: 99 us for 2048 dirty pages
> > get dirty log: 132 us for 4096 dirty pages
> > get dirty log: 224 us for 8192 dirty pages
> > get dirty log: 383 us for 16384 dirty pages
> > get dirty log: 725 us for 32768 dirty pages
> > get dirty log: 1412 us for 65536 dirty pages
> > get dirty log: 2746 us for 131072 dirty pages
> > get dirty log: 5455 us for 262144 dirty pages
>
> Nice!
I forgot to add warming up, letting the guest scan the memory,
before starting the test.
So the number of shadow pages was increasing during the test.
>
> > +
> > +void write_mem(volatile bool& running, volatile int& nr_dirty_pages,
> > + void* logged_slot_virt)
> > +{
> > + while (nr_dirty_pages >= 0) {
> > + char* var = static_cast<char*>(logged_slot_virt);
> > +
> > + while (!running) {
> > + delay_loop(1000);
> > + }
> > + for (int i = 0; i < nr_dirty_pages; ++i) {
> > + ++(*var);
> > + var += page_size;
> > + }
> > + running = false;
>
> You use running both to start this loop, and signal its end. Better to
> use two variables.
>
> But why use threads at all? Just call this before reading the dirty
> log, no need for synchronization.
I re-used your dirty-log code a lot, will update.
>
> > + }
> > +}
> > +
> > +void check_dirty_log(mem_slot& slot,
> > + volatile bool& running,
> > + volatile int& nr_dirty_pages)
> > +{
> > + slot.set_dirty_logging(true);
> > + slot.update_dirty_log();
> > +
> > + for (int i = 1; i <= nr_pages; i *= 2) {
> > + struct timeval start_time, end_time;
> > + long time_usec;
> > +
> > + nr_dirty_pages = i;
> > + running = true;
> > + // wait until the guest finishes writing
> > + while (running) {
> > + delay_loop(1000);
> > + }
> > +
> > + gettimeofday(&start_time, NULL);
> > + slot.update_dirty_log();
> > + gettimeofday(&end_time, NULL);
>
> Nicer to have a function that returns time in nanoseconds.
I don't know such an API which can be used in userspace.
If we can use nano-precision timer, I want to check other things
too, e.g. emulation.
Takuya
--
Takuya Yoshikawa <takuya.yoshikawa@gmail.com>
next prev parent reply other threads:[~2012-01-08 14:49 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-01-08 13:58 [RFC kvm-unit-tests] api: Add dirty logging performance test Takuya Yoshikawa
2012-01-08 14:21 ` Avi Kivity
2012-01-08 14:49 ` Takuya Yoshikawa [this message]
2012-01-08 14:54 ` Avi Kivity
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=20120108234925.f3cd34c9ead6ad9c3e07b980@gmail.com \
--to=takuya.yoshikawa@gmail.com \
--cc=avi@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=mtosatti@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