From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=47310 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OPamk-00046K-6Y for qemu-devel@nongnu.org; Fri, 18 Jun 2010 08:35:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OPamf-00079z-GH for qemu-devel@nongnu.org; Fri, 18 Jun 2010 08:35:02 -0400 Received: from mail-gw0-f45.google.com ([74.125.83.45]:53663) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OPamf-00079k-D4 for qemu-devel@nongnu.org; Fri, 18 Jun 2010 08:34:57 -0400 Received: by gwaa20 with SMTP id a20so585661gwa.4 for ; Fri, 18 Jun 2010 05:34:56 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: <4C1B5F74.8040609@linux.vnet.ibm.com> References: <20100616180542.474535e3@zephyr> <20100616181206.65186bc4@zephyr> <20100617150810.GA15845@stefan-thinkpad.transitives.com> <4C1B5F74.8040609@linux.vnet.ibm.com> Date: Fri, 18 Jun 2010 13:34:55 +0100 Message-ID: From: Stefan Hajnoczi Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] Re: [PATCH 2/3] Monitor command 'info trace' List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Prerna Saxena Cc: Anthony Liguori , Stefan Hajnoczi , kvm@vger.kernel.org, qemu-devel@nongnu.org, Luiz Capitulino , Maneesh Soni , Ananth , Stefan@us.ibm.com On Fri, Jun 18, 2010 at 12:58 PM, Prerna Saxena wrote: > Hi Stefan, Jan, > Thanks for taking a look. > > On 06/17/2010 08:38 PM, Stefan Hajnoczi wrote: >> >> On Wed, Jun 16, 2010 at 06:12:06PM +0530, Prerna Saxena wrote: >>> >>> 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 >>> =A0void trace5(TraceEvent event, unsigned long x1, unsigned long x2, >>> unsigned long x3, unsigned long x4, unsigned long x5) { >>> =A0 =A0 =A0trace(event, x1, x2, x3, x4, x5); >>> =A0} >>> + >>> +void do_info_trace(Monitor *mon) >>> +{ >>> + =A0 =A0unsigned int i, max_idx; >>> + >>> + =A0 =A0max_idx =3D trace_idx ? trace_idx : TRACE_BUF_LEN; >> >> trace_idx is always in the range [0, TRACE_BUF_LEN). =A0There is no need >> to perform this test. > > I only display the logged contents in the trace buffer (till trace_idx) , > and not the entire trace buffer. Only when the index is full that the ent= ire > buffer is displayed. Thanks for explaining, I understand what you are doing now. Due to this special case, the code will dump out the empty trace buffer if used before anything has been traced (trace_idx=3D0). >>> + =A0 =A0 =A0 =A0monitor_printf(mon, "Event %ld : %ld %ld %ld %ld %ld\n= ", >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0trace_buf[i].event= , trace_buf[i].x1, >>> trace_buf[i].x2, >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0trace_buf[i].x= 3, trace_buf[i].x4, >>> trace_buf[i].x5); >> >> Getting only numeric output is the limitation of a binary trace. =A0It >> would probably be possible to pretty-print without much additional code >> by using the format strings from the trace-events file. >> >> I think the numeric dump is good for now though. =A0Hex is more compact >> than decimal and would make pointers easier to spot. =A0Want to change >> this? >> > > I agree, but we can let this be a todo till after the first prototype goe= s > upstream ? I still vote for hex instead of decimal :). Since you're already spinning a new patch it would be nice to put that change in, but no worries. > I'll post patches by Monday that addresses your suggestions, and try to g= et > it integrated with QMP. Excellent, thanks. I'd like to put your patches onto my tracing branch soon and test out the overall workflow of tracing QEMU. Stefan