[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH] Optimize screendump
From: |
Avi Kivity |
Subject: |
[Qemu-devel] [PATCH] Optimize screendump |
Date: |
Sun, 19 Jun 2011 17:54:33 +0300 |
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 <address@hidden>
---
hw/vga.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/hw/vga.c b/hw/vga.c
index d5bc582..8b63358 100644
--- a/hw/vga.c
+++ b/hw/vga.c
@@ -2369,9 +2369,9 @@ int ppm_save(const char *filename, struct DisplaySurface
*ds)
(ds->pf.gmax + 1);
b = ((v >> ds->pf.bshift) & ds->pf.bmax) * 256 /
(ds->pf.bmax + 1);
- fputc(r, f);
- fputc(g, f);
- fputc(b, f);
+ fputc_unlocked(r, f);
+ fputc_unlocked(g, f);
+ fputc_unlocked(b, f);
d += ds->pf.bytes_per_pixel;
}
d1 += ds->linesize;
--
1.7.5.3
- [Qemu-devel] [PATCH] Optimize screendump,
Avi Kivity <=