From patchwork Tue Jun 8 07:04:37 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Prerna Saxena X-Patchwork-Id: 104891 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o5874wZo029705 for ; Tue, 8 Jun 2010 07:04:58 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753606Ab0FHHE4 (ORCPT ); Tue, 8 Jun 2010 03:04:56 -0400 Received: from e28smtp08.in.ibm.com ([122.248.162.8]:57530 "EHLO e28smtp08.in.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753169Ab0FHHEz (ORCPT ); Tue, 8 Jun 2010 03:04:55 -0400 Received: from d28relay03.in.ibm.com (d28relay03.in.ibm.com [9.184.220.60]) by e28smtp08.in.ibm.com (8.14.4/8.13.1) with ESMTP id o585wGVY030085 for ; Tue, 8 Jun 2010 11:28:16 +0530 Received: from d28av02.in.ibm.com (d28av02.in.ibm.com [9.184.220.64]) by d28relay03.in.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id o5874fwt2920552 for ; Tue, 8 Jun 2010 12:34:41 +0530 Received: from d28av02.in.ibm.com (loopback [127.0.0.1]) by d28av02.in.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id o5874eAk014888 for ; Tue, 8 Jun 2010 17:04:41 +1000 Received: from zephyr ([9.124.35.20]) by d28av02.in.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id o5874een014885; Tue, 8 Jun 2010 17:04:40 +1000 Date: Tue, 8 Jun 2010 12:34:37 +0530 From: Prerna Saxena To: qemu-devel@nongnu.org Cc: Anthony Liguori , Stefan Hajnoczi , kvm@vger.kernel.org, Kiszka , maneesh@linux.vnet.ibm.com, ananth@linux.vnet.ibm.com Subject: [PATCH 2/3] Monitor command 'trace' Message-ID: <20100608123437.5f87d045@zephyr> In-Reply-To: <20100608122803.6a684a5e@zephyr> References: <20100608122803.6a684a5e@zephyr> Organization: IBM X-Mailer: Claws Mail 3.7.5 (GTK+ 2.16.6; i586-redhat-linux-gnu) Mime-Version: 1.0 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Tue, 08 Jun 2010 07:04:58 +0000 (UTC) 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..fda29aa 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 diff --git a/qemu-monitor.hx b/qemu-monitor.hx index b6e3467..c604aec 100644 --- a/qemu-monitor.hx +++ b/qemu-monitor.hx @@ -221,6 +221,22 @@ STEXI @item logfile @var{filename} @findex logfile Output logs to @var{filename}. +#ifdef CONFIG_SIMPLE_TRACE +ETEXI + + { + .name = "trace", + .args_type = "", + .params = "", + .help = "shows contents of trace buffer", + .mhandler.cmd = do_info_trace, + }, + +STEXI +@item trace +@findex trace +show contents of trace buffer +#endif ETEXI { diff --git a/simpletrace.c b/simpletrace.c index 2fec4d3..8f33a81 100644 --- a/simpletrace.c +++ b/simpletrace.c @@ -62,3 +62,18 @@ 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) { + static unsigned int i, max_idx; + + if (trace_idx) + max_idx = trace_idx; + else + max_idx = TRACE_BUF_LEN; + + for (i=0; i