From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:51132) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rqedb-0001ML-10 for qemu-devel@nongnu.org; Fri, 27 Jan 2012 00:46:16 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RqedZ-0005pp-Lr for qemu-devel@nongnu.org; Fri, 27 Jan 2012 00:46:14 -0500 Date: Fri, 27 Jan 2012 05:46:06 +0000 From: Stefan Hajnoczi Message-ID: <20120127054606.GC17836@stefanha-thinkpad.localdomain> References: <1327108107-16600-1-git-send-email-mdroth@linux.vnet.ibm.com> <1327166033-17922-1-git-send-email-mdroth@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1327166033-17922-1-git-send-email-mdroth@linux.vnet.ibm.com> Subject: Re: [Qemu-devel] [Qemu-trivial] [PATCH] main-loop: For tools, initialize timers as part of qemu_init_main_loop() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Michael Roth Cc: qemu-trivial@nongnu.org, pbonzini@redhat.com, qemu-devel@nongnu.org On Sat, Jan 21, 2012 at 11:13:53AM -0600, Michael Roth wrote: > In some cases initializing the alarm timers can lead to non-negligable > overhead from programs that link against qemu-tool.o. At least, > setting a max-resolution WinMM alarm timer via mm_start_timer() (the > current default for Windows) can increase the "tick rate" on Windows > OSs and affect frequency scaling, and in the case of tools that run > in guest OSs such has qemu-ga, the impact can be fairly dramatic > (+20%/20% user/sys time on a core 2 processor was observed from an idle > Windows XP guest). > > This patch doesn't address the issue directly (not sure what a good > solution would be for Windows, or what other situations it might be > noticeable), but it at least limits the scope of the issue to programs > that "opt-in" to using the main-loop.c functions by only enabling alarm > timers when qemu_init_main_loop() is called, which is already required > to make use of those facilities, so existing users shouldn't be > affected. > > Signed-off-by: Michael Roth > --- > main-loop.c | 2 +- > main-loop.h | 12 ++++++++++++ > qemu-tool.c | 3 ++- > vl.c | 5 +++++ > 4 files changed, 20 insertions(+), 2 deletions(-) static struct qemu_alarm_timer alarm_timers[] = { #ifndef _WIN32 #ifdef __linux__ {"dynticks", dynticks_start_timer, dynticks_stop_timer, dynticks_rearm_timer}, #endif {"unix", unix_start_timer, unix_stop_timer, unix_rearm_timer}, #else {"mmtimer", mm_start_timer, mm_stop_timer, mm_rearm_timer}, {"dynticks", win32_start_timer, win32_stop_timer, win32_rearm_timer}, #endif It seems Windows host already has a "dynticks" implementation. Have you tried using this instead of "mmtimer"? mm_start_timer() is using 1 ms intervals! Stefan