From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=56254 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PJ86c-0005Jb-Ic for qemu-devel@nongnu.org; Thu, 18 Nov 2010 12:17:08 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PJ86b-0000EI-9c for qemu-devel@nongnu.org; Thu, 18 Nov 2010 12:17:06 -0500 Received: from e5.ny.us.ibm.com ([32.97.182.145]:37709) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PJ86b-0000DY-6k for qemu-devel@nongnu.org; Thu, 18 Nov 2010 12:17:05 -0500 Received: from d01relay05.pok.ibm.com (d01relay05.pok.ibm.com [9.56.227.237]) by e5.ny.us.ibm.com (8.14.4/8.13.1) with ESMTP id oAIGtPnE015126 for ; Thu, 18 Nov 2010 11:55:26 -0500 Received: from d01av01.pok.ibm.com (d01av01.pok.ibm.com [9.56.224.215]) by d01relay05.pok.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id oAIHH1R7163958 for ; Thu, 18 Nov 2010 12:17:01 -0500 Received: from d01av01.pok.ibm.com (loopback [127.0.0.1]) by d01av01.pok.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id oAIHH0Xq015974 for ; Thu, 18 Nov 2010 12:17:01 -0500 Message-ID: <4CE55F8C.5010106@linux.vnet.ibm.com> Date: Thu, 18 Nov 2010 11:17:00 -0600 From: Michael Roth MIME-Version: 1.0 Subject: Re: [Qemu-devel] [RFC][PATCH v3 03/21] virtproxy: add debug functions for virtproxy core 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> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Hajnoczi 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 11/18/2010 05:43 AM, Stefan Hajnoczi wrote: > On Thu, Nov 18, 2010 at 11:09 AM, Jes Sorensen wrote: >> On 11/16/10 02:15, Michael Roth wrote: >>> Signed-off-by: Michael Roth >>> --- >>> virtproxy.c | 17 +++++++++++++++++ >>> 1 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 @@ >>> >>> #include "virtproxy.h" >>> >>> +#define DEBUG_VP >>> + >>> +#ifdef DEBUG_VP >>> +#define TRACE(msg, ...) do { \ >>> + fprintf(stderr, "%s:%s():L%d: " msg "\n", \ >>> + __FILE__, __FUNCTION__, __LINE__, ## __VA_ARGS__); \ >>> +} while(0) >>> +#else >>> +#define TRACE(msg, ...) \ >>> + do { } while (0) >>> +#endif >>> + >>> +#define LOG(msg, ...) do { \ >>> + fprintf(stderr, "%s:%s(): " msg "\n", \ >>> + __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. How 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? > Stefan