From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Daniel P. Berrange" Subject: Re: qemu-dm performance Date: Wed, 20 Sep 2006 22:03:27 +0100 Message-ID: <20060920210327.GG4273@redhat.com> References: <1158782504.4960.142.camel@mah-chine> Reply-To: "Daniel P. Berrange" Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Content-Disposition: inline In-Reply-To: <1158782504.4960.142.camel@mah-chine> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Tommie McAfee Cc: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org On Wed, Sep 20, 2006 at 04:01:44PM -0400, Tommie McAfee wrote: > Also, where else should I look in the code for possible explanations to > why qemu-dm uses 20% CPU simply to view a guest. All comments and > suggestions regarding this matter are appreciated, Rather than looking at the code, try using a profiling tool like OProfile to instrument exactly where the runtime is going. For example running it against qemu-dm instance on my Fedora Core 6 Xen host shows the following top hot-spots: # opcontrol --setup --separate=library,kernel \ --vmlinux=/usr/lib/debug/lib/modules/2.6.17-1.2647.fc6/vmlinux \ -e CPU_CLK_UNHALTED:100000: # opcontrol --start # opreport /usr/lib64/xen/bin/qemu-dm -a -l 2>/dev/null | head -7 Counted CPU_CLK_UNHALTED events (Cycles outside of halt state) with a unit mask of 0x00 (No unit mask) count 100000 samples cum. samples % cum. % image name symbol name 391713 391713 56.1887 56.1887 qemu-dm vram_dirty 202108 593821 28.9911 85.1798 qemu-dm _vnc_update_client 99266 693087 14.2391 99.4189 qemu-dm vga_draw_line24_32 2023 695110 0.2902 99.7091 qemu-dm vga_update_display Fortunately this profile shows some clear hotspots to examine in greater details - 3 sxamples accounting for 98% of all CPU time in qemu-dm This is with a single VNC client connected, but not actively doing anything in the guest framebuffer, using RHEL-3 as the fully-virt guest. If you have debuginfo available you can even get source file annotations of where the hits are. For example, taking the 2nd hit there: # opannotate /usr/lib64/xen/bin/qemu-dm --source -i _vnc_update_client ....snip start of source.... 14800 1.5009 : for (x = 0; x < X2DP_UP(vs, vs->ds->width); x++) { 9928 1.0068 : if (vs->dirty_row[y] & (1ULL << x)) { 936343 94.9594 : if (memcmp(old_ptr, ptr, tile_bytes)) { : vs->has_update = 1; 1 1.0e-04 : vs->update_row[y] |= (1ULL << x); : memcpy(old_ptr, ptr, tile_bytes); : } 14513 1.4718 : vs->dirty_row[y] &= ~(1ULL << x); : } : 4742 0.4809 : ptr += tile_bytes; : old_ptr += tile_bytes; : } ......snip rest of source.... Regards, Dan. -- |=- Red Hat, Engineering, Emerging Technologies, Boston. +1 978 392 2496 -=| |=- Perl modules: http://search.cpan.org/~danberr/ -=| |=- Projects: http://freshmeat.net/~danielpb/ -=| |=- GnuPG: 7D3B9505 F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 -=|