From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=45283 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PNf12-0007Fr-LS for qemu-devel@nongnu.org; Wed, 01 Dec 2010 00:14:27 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PNNZK-0002uu-C6 for qemu-devel@nongnu.org; Tue, 30 Nov 2010 05:36:19 -0500 Received: from mtagate5.uk.ibm.com ([194.196.100.165]:40994) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PNNZK-0002gy-4B for qemu-devel@nongnu.org; Tue, 30 Nov 2010 05:36:18 -0500 Received: from d06nrmr1806.portsmouth.uk.ibm.com (d06nrmr1806.portsmouth.uk.ibm.com [9.149.39.193]) by mtagate5.uk.ibm.com (8.13.1/8.13.1) with ESMTP id oAUAaANw026766 for ; Tue, 30 Nov 2010 10:36:10 GMT Received: from d06av03.portsmouth.uk.ibm.com (d06av03.portsmouth.uk.ibm.com [9.149.37.213]) by d06nrmr1806.portsmouth.uk.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id oAUAa42p3764360 for ; Tue, 30 Nov 2010 10:36:12 GMT Received: from d06av03.portsmouth.uk.ibm.com (localhost.localdomain [127.0.0.1]) by d06av03.portsmouth.uk.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id oAUAa1oa020173 for ; Tue, 30 Nov 2010 03:36:01 -0700 Date: Tue, 30 Nov 2010 10:36:00 +0000 From: Stefan Hajnoczi Subject: Re: [Qemu-devel] [PATCH 03/10] Add printf debug to savevm Message-ID: <20101130103557.GA23629@stefan-thinkpad.transitives.com> References: <4CF45AB2.7050506@codemonkey.ws> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4CF45AB2.7050506@codemonkey.ws> List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Juan Quintela Cc: Anthony Liguori , qemu-devel@nongnu.org, Juan Quintela On Mon, Nov 29, 2010 at 08:00:18PM -0600, Anthony Liguori wrote: > Yeah, all of this should be done via tracing. Maybe Stefan can make > some suggestions. Here is an example of how to record savevm timestamps using tracing. Actually the timestamp is recorded automatically when a trace event fires. Add these to the trace-events file: savevm_start(void) "" savevm_stop(unsigned int section_id) "section_id %u" Then use trace_savevm_start() instead of START_SAVEVM_CLOCK() and trace_savevm_stop() instead of STOP_SAVEVM_CLOCK() in savevm.c. Also #include "trace.h". All the macros and inline timestamp analysis can be removed from savevm.c. ./configure --trace-backend=simple [...] make After running savevm look for the trace- file that QEMU produces in its current working directory. You can pretty-print it like this: ./simpletrace.py trace-events trace- The second field in the simpletrace.py output is the time delta (in microseconds) since the last trace event. So you can easily see how long start->stop took. For more info see docs/tracing.txt. You might prefer to use SystemTap (./configure --trace-backend=dtrace) so you can write stap scripts to do more powerful analysis. Stefan