From patchwork Wed Jun 16 12:42:06 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Prerna Saxena X-Patchwork-Id: 106485 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 o5GCgE7i000675 for ; Wed, 16 Jun 2010 12:42:14 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755200Ab0FPMmM (ORCPT ); Wed, 16 Jun 2010 08:42:12 -0400 Received: from e23smtp09.au.ibm.com ([202.81.31.142]:42086 "EHLO e23smtp09.au.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752200Ab0FPMmM (ORCPT ); Wed, 16 Jun 2010 08:42:12 -0400 Received: from d23relay03.au.ibm.com (d23relay03.au.ibm.com [202.81.31.245]) by e23smtp09.au.ibm.com (8.14.4/8.13.1) with ESMTP id o5GCg7Rc015397 for ; Wed, 16 Jun 2010 22:42:07 +1000 Received: from d23av01.au.ibm.com (d23av01.au.ibm.com [9.190.234.96]) by d23relay03.au.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id o5GCgAMZ1724638 for ; Wed, 16 Jun 2010 22:42:10 +1000 Received: from d23av01.au.ibm.com (loopback [127.0.0.1]) by d23av01.au.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id o5GCg9ct006836 for ; Wed, 16 Jun 2010 22:42:10 +1000 Received: from zephyr (K50wks273870wss.in.ibm.com [9.124.35.32]) by d23av01.au.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id o5GCg7ke006816; Wed, 16 Jun 2010 22:42:08 +1000 Date: Wed, 16 Jun 2010 18:12:06 +0530 From: Prerna Saxena To: Prerna Saxena Cc: qemu-devel@nongnu.org, Anthony Liguori , Hajnoczi , kvm@vger.kernel.org, Stefan@us.ibm.com, Luiz Capitulino , Maneesh Soni Subject: [PATCH 2/3] Monitor command 'info trace' Message-ID: <20100616181206.65186bc4@zephyr> In-Reply-To: <20100616180542.474535e3@zephyr> References: <20100616180542.474535e3@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]); Wed, 16 Jun 2010 12:42:15 +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..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..239ae3f 100644 --- a/simpletrace.c +++ b/simpletrace.c @@ -62,3 +62,16 @@ 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