From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=34327 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PNhSg-0007EA-Ti for qemu-devel@nongnu.org; Wed, 01 Dec 2010 02:50:48 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PNhSf-00066T-Ru for qemu-devel@nongnu.org; Wed, 01 Dec 2010 02:50:46 -0500 Received: from mtagate3.uk.ibm.com ([194.196.100.163]:43748) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PNhSf-00066G-JG for qemu-devel@nongnu.org; Wed, 01 Dec 2010 02:50:45 -0500 Received: from d06nrmr1307.portsmouth.uk.ibm.com (d06nrmr1307.portsmouth.uk.ibm.com [9.149.38.129]) by mtagate3.uk.ibm.com (8.13.1/8.13.1) with ESMTP id oB17ohms002362 for ; Wed, 1 Dec 2010 07:50:43 GMT Received: from d06av10.portsmouth.uk.ibm.com (d06av10.portsmouth.uk.ibm.com [9.149.37.251]) by d06nrmr1307.portsmouth.uk.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id oB17ofDQ3592228 for ; Wed, 1 Dec 2010 07:50:41 GMT Received: from d06av10.portsmouth.uk.ibm.com (loopback [127.0.0.1]) by d06av10.portsmouth.uk.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id oB17og8J004911 for ; Wed, 1 Dec 2010 00:50:42 -0700 Date: Wed, 1 Dec 2010 07:50:42 +0000 From: Stefan Hajnoczi Message-ID: <20101201075041.GB13542@stefan-thinkpad.transitives.com> References: <4CF45AB2.7050506@codemonkey.ws> <20101130103557.GA23629@stefan-thinkpad.transitives.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Subject: [Qemu-devel] Re: [PATCH 03/10] Add printf debug to savevm 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 On Tue, Nov 30, 2010 at 11:40:36PM +0100, Juan Quintela wrote: > Stefan Hajnoczi wrote: > > 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. > > Thanks. > > Searching for guru, I basically want to only print the values when the > difference is bigger that some values (number of calls is really big, I > need to learn how to script the analisys). You can use awk(1) on the simpletrace.py output: $1 ~ /savevm_stop/ { /* Print savevm_stop line when >100 ms duration */ if ($2 > 100000) { printf("%s times_missing=%u\n", $0, times_missing++); } } Or you can use --trace-backend=dtrace and write SystemTap scripts: http://sourceware.org/systemtap/SystemTap_Beginners_Guide/ http://sourceware.org/systemtap/langref/ Stefan