From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=34573 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PJN9e-0001Pv-LC for qemu-devel@nongnu.org; Fri, 19 Nov 2010 04:21:21 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PJN9U-0006Nk-EL for qemu-devel@nongnu.org; Fri, 19 Nov 2010 04:21:11 -0500 Received: from mail-wy0-f173.google.com ([74.125.82.173]:39599) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PJN9U-0006Na-8j for qemu-devel@nongnu.org; Fri, 19 Nov 2010 04:21:04 -0500 Received: by wyj26 with SMTP id 26so4422683wyj.4 for ; Fri, 19 Nov 2010 01:21:03 -0800 (PST) MIME-Version: 1.0 In-Reply-To: <4CE55F8C.5010106@linux.vnet.ibm.com> References: <1289870175-14880-1-git-send-email-mdroth@linux.vnet.ibm.com> <1289870175-14880-4-git-send-email-mdroth@linux.vnet.ibm.com> <4CE50956.90400@redhat.com> <4CE55F8C.5010106@linux.vnet.ibm.com> Date: Fri, 19 Nov 2010 09:21:02 +0000 Message-ID: Subject: Re: [Qemu-devel] [RFC][PATCH v3 03/21] virtproxy: add debug functions for virtproxy core From: Stefan Hajnoczi Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Michael Roth Cc: agl@linux.vnet.ibm.com, Jes Sorensen , qemu-devel@nongnu.org, aliguori@linux.vnet.ibm.com, ryanh@us.ibm.com, abeekhof@redhat.com, amit.shah@redhat.com On Thu, Nov 18, 2010 at 5:17 PM, Michael Roth w= rote: > On 11/18/2010 05:43 AM, Stefan Hajnoczi wrote: >> >> On Thu, Nov 18, 2010 at 11:09 AM, Jes Sorensen >> =A0wrote: >>> >>> On 11/16/10 02:15, Michael Roth wrote: >>>> >>>> Signed-off-by: Michael Roth >>>> --- >>>> =A0virtproxy.c | =A0 17 +++++++++++++++++ >>>> =A01 files changed, 17 insertions(+), 0 deletions(-) >>>> >>>> diff --git a/virtproxy.c b/virtproxy.c >>>> index 8f18d83..3686c77 100644 >>>> --- a/virtproxy.c >>>> +++ b/virtproxy.c >>>> @@ -13,6 +13,23 @@ >>>> >>>> =A0#include "virtproxy.h" >>>> >>>> +#define DEBUG_VP >>>> + >>>> +#ifdef DEBUG_VP >>>> +#define TRACE(msg, ...) do { \ >>>> + =A0 =A0fprintf(stderr, "%s:%s():L%d: " msg "\n", \ >>>> + =A0 =A0 =A0 =A0 =A0 =A0__FILE__, __FUNCTION__, __LINE__, ## __VA_ARG= S__); \ >>>> +} while(0) >>>> +#else >>>> +#define TRACE(msg, ...) \ >>>> + =A0 =A0do { } while (0) >>>> +#endif >>>> + >>>> +#define LOG(msg, ...) do { \ >>>> + =A0 =A0fprintf(stderr, "%s:%s(): " msg "\n", \ >>>> + =A0 =A0 =A0 =A0 =A0 =A0__FILE__, __FUNCTION__, ## __VA_ARGS__); \ >>>> +} while(0) >>>> + >>> >>> I wonder if it wouldn't make sense to do this in a more generic way and >>> stick it in a header file. This type of debug code seems to show up >>> repeatedly all over the place. >> >> I wanted to suggest actually using QEMU tracing but given that this >> code compiles stand-alone, it may be more trouble to integrate than >> it's worth. >> >> For qemu and qemu-tools code we should be using tracing because you >> can build it into production without high overhead. =A0How often do >> these #defines get used, not often is my guess because no one wants to >> tweak the source and rebuild, especially not in production. >> > > I'd planned on replacing the TRACE()'s with trace calls eventually. Maybe= I > missed it in the documentation, but do we have a way to enable them for > qemu-tools or does we need to provide our own hooks and do it > programmatically? qemu-tools builds with QEMU tracing. I wasn't sure whether you're building in the qemu-tools style or whether qemu-vp is a completely separate program. So if qemu-vp is built with all the common qemu-tools make infrastructure, then you should have tracing in there. Stefan