From patchwork Thu Jun 10 19:20:27 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Prerna Saxena X-Patchwork-Id: 55244 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) by ozlabs.org (Postfix) with ESMTP id 71F16B7D96 for ; Fri, 11 Jun 2010 05:28:41 +1000 (EST) Received: from localhost ([127.0.0.1]:44073 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OMnKz-00042i-0q for incoming@patchwork.ozlabs.org; Thu, 10 Jun 2010 15:22:49 -0400 Received: from [140.186.70.92] (port=34995 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OMnJC-0003Mb-C9 for qemu-devel@nongnu.org; Thu, 10 Jun 2010 15:21:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OMnIr-0002LL-Lc for qemu-devel@nongnu.org; Thu, 10 Jun 2010 15:20:38 -0400 Received: from e28smtp07.in.ibm.com ([122.248.162.7]:44353) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OMnIq-0002Kg-Tb for qemu-devel@nongnu.org; Thu, 10 Jun 2010 15:20:37 -0400 Received: from d28relay03.in.ibm.com (d28relay03.in.ibm.com [9.184.220.60]) by e28smtp07.in.ibm.com (8.14.4/8.13.1) with ESMTP id o5AJKVNf014758 for ; Fri, 11 Jun 2010 00:50:31 +0530 Received: from d28av04.in.ibm.com (d28av04.in.ibm.com [9.184.220.66]) by d28relay03.in.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id o5AJKVOt1835200 for ; Fri, 11 Jun 2010 00:50:31 +0530 Received: from d28av04.in.ibm.com (loopback [127.0.0.1]) by d28av04.in.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id o5AJKU4Q022581 for ; Fri, 11 Jun 2010 05:20:30 +1000 Received: from zephyr ([9.77.123.112]) by d28av04.in.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id o5AJKTTe022564; Fri, 11 Jun 2010 05:20:29 +1000 Date: Fri, 11 Jun 2010 00:50:27 +0530 From: Prerna Saxena To: qemu-devel@nongnu.org Message-ID: <20100611005027.22f88673@zephyr> In-Reply-To: <20100611003811.2635fa5d@zephyr> References: <20100611003811.2635fa5d@zephyr> Organization: IBM X-Mailer: Claws Mail 3.7.5 (GTK+ 2.16.6; i586-redhat-linux-gnu) Mime-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) Cc: Anthony Liguori , Stefan Hajnoczi , kvm@vger.kernel.org, Jan Kiszka , Luiz Capitulino , maneesh@linux.vnet.ibm.com, ananth@linux.vnet.ibm.com Subject: [Qemu-devel] [RFC v2] [PATCH 2/3] Monitor command 'info trace' X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org This introduces the monitor command 'info trace' to display current contents of trace buffer. Signed-off-by: Prerna Saxena --- configure | 3 +++ monitor.c | 12 ++++++++++++ qemu-monitor.hx | 4 ++++ simpletrace.c | 12 ++++++++++++ tracetool | 2 ++ 5 files changed, 33 insertions(+), 0 deletions(-) diff --git a/configure b/configure index 675d0fc..56af8dd 100755 --- a/configure +++ b/configure @@ -2302,6 +2302,9 @@ bsd) esac echo "TRACE_BACKEND=$trace_backend" >> $config_host_mak +if test "$trace_backend" = "simple"; then + echo "CONFIG_SIMPLE_TRACE=y" >> $config_host_mak +fi if test "$trace_backend" = "ust"; then LIBS="-lust $LIBS" fi diff --git a/monitor.c b/monitor.c index ad50f12..8b60830 100644 --- a/monitor.c +++ b/monitor.c @@ -55,6 +55,9 @@ #include "json-streamer.h" #include "json-parser.h" #include "osdep.h" +#ifdef CONFIG_SIMPLE_TRACE +#include "trace.h" +#endif //#define DEBUG //#define DEBUG_COMPLETION @@ -2780,6 +2783,15 @@ static const mon_cmd_t info_cmds[] = { .help = "show roms", .mhandler.info = do_info_roms, }, +#if defined(CONFIG_SIMPLE_TRACE) + { + .name = "trace", + .args_type = "", + .params = "", + .help = "show current contents of trace buffer", + .mhandler.info = do_info_trace, + }, +#endif { .name = NULL, }, diff --git a/qemu-monitor.hx b/qemu-monitor.hx index b6e3467..766c30f 100644 --- a/qemu-monitor.hx +++ b/qemu-monitor.hx @@ -114,6 +114,10 @@ show migration status show balloon information @item info qtree show device tree +#ifdef CONFIG_SIMPLE_TRACE +@item info trace +show contents of trace buffer +#endif @end table ETEXI diff --git a/simpletrace.c b/simpletrace.c index 2fec4d3..00df45a 100644 --- a/simpletrace.c +++ b/simpletrace.c @@ -62,3 +62,15 @@ void trace4(TraceEvent event, unsigned long x1, unsigned long x2, unsigned long void trace5(TraceEvent event, unsigned long x1, unsigned long x2, unsigned long x3, unsigned long x4, unsigned long x5) { trace(event, x1, x2, x3, x4, x5); } + +void do_info_trace(Monitor *mon) +{ + unsigned int i, max_idx; + + max_idx = trace_idx ? trace_idx : TRACE_BUF_LEN; + + for (i=0; i