qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Hajnoczi <stefanha@gmail.com>
To: Avi Kivity <avi@redhat.com>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] Optimize screendump
Date: Sun, 19 Jun 2011 16:22:48 +0100	[thread overview]
Message-ID: <BANLkTikD7xampygKPvrb1mmMfAPACLGCDw@mail.gmail.com> (raw)
In-Reply-To: <1308495273-23383-1-git-send-email-avi@redhat.com>

On Sun, Jun 19, 2011 at 3:54 PM, Avi Kivity <avi@redhat.com> wrote:
> When running kvm-autotest, fputc() is often the second highest (sometimes #1)
> function showing up in a profile.  This is due to fputc() locking the file
> for every byte written.
>
> Optimize by using fputc_unlocked().  Since the file is local to the caller,
> clearly no locking is needed.  According to the manual, _GNU_SOURCE is all
> that's needed for the function to be present.
>
> Signed-off-by: Avi Kivity <avi@redhat.com>
> ---
>  hw/vga.c |    6 +++---
>  1 files changed, 3 insertions(+), 3 deletions(-)

"The nonstandard *_unlocked() variants occur on a few Unix systems,
and are available in recent glibc. They should probably not be used."

I wonder if this will break non-Linux platforms.  Perhaps buffer an
entire row of pixels instead and only fwrite(3) at the end of the
outer loop.

Stefan

  parent reply	other threads:[~2011-06-19 15:22 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-19 14:54 [Qemu-devel] [PATCH] Optimize screendump Avi Kivity
2011-06-19 15:05 ` malc
2011-06-19 15:22 ` Stefan Hajnoczi [this message]
2011-06-19 15:46   ` Avi Kivity
2011-06-19 15:53     ` Andreas Färber
2011-06-19 16:04       ` Avi Kivity
2011-06-19 17:00         ` Alexander Graf
2011-06-20  8:04           ` 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=BANLkTikD7xampygKPvrb1mmMfAPACLGCDw@mail.gmail.com \
    --to=stefanha@gmail.com \
    --cc=avi@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /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).