From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52687) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YED1C-00005Z-4L for qemu-devel@nongnu.org; Thu, 22 Jan 2015 03:21:35 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YED18-0003rp-Tb for qemu-devel@nongnu.org; Thu, 22 Jan 2015 03:21:34 -0500 Received: from mail-wi0-f173.google.com ([209.85.212.173]:48570) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YED18-0003rh-N0 for qemu-devel@nongnu.org; Thu, 22 Jan 2015 03:21:30 -0500 Received: by mail-wi0-f173.google.com with SMTP id r20so40012911wiv.0 for ; Thu, 22 Jan 2015 00:21:29 -0800 (PST) Date: Thu, 22 Jan 2015 09:21:27 +0100 From: Jiri Pirko Message-ID: <20150122082127.GA1863@nanopsycho.orion> References: <1421913839-22448-1-git-send-email-sfeldma@gmail.com> <1421913839-22448-11-git-send-email-sfeldma@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1421913839-22448-11-git-send-email-sfeldma@gmail.com> Subject: Re: [Qemu-devel] [PATCH v5 10/10] rocker: timestamp on the debug logs helps correlate with events in the VM List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: sfeldma@gmail.com Cc: stefanha@gmail.com, roopa@cumulusnetworks.com, john.fastabend@gmail.com, qemu-devel@nongnu.org, dsahern@gmail.com, pbonzini@redhat.com, jasowang@redhat.com Thu, Jan 22, 2015 at 09:03:59AM CET, sfeldma@gmail.com wrote: >From: David Ahern > >Signed-off-by: David Ahern >Signed-off-by: Scott Feldman Signed-off-by: Jiri Pirko >--- > hw/net/rocker/rocker.h | 11 ++++++++++- > 1 file changed, 10 insertions(+), 1 deletion(-) > >diff --git a/hw/net/rocker/rocker.h b/hw/net/rocker/rocker.h >index ef77487..5ae8aff 100644 >--- a/hw/net/rocker/rocker.h >+++ b/hw/net/rocker/rocker.h >@@ -25,7 +25,16 @@ > > #if defined(DEBUG_ROCKER) > # define DPRINTF(fmt, ...) \ >- do { fprintf(stderr, "ROCKER: " fmt, ## __VA_ARGS__); } while (0) >+ do { \ >+ struct timeval tv; \ >+ char timestr[64]; \ >+ time_t now; \ >+ gettimeofday(&tv, NULL); \ >+ now = tv.tv_sec; \ >+ strftime(timestr, sizeof(timestr), "%T", localtime(&now)); \ >+ fprintf(stderr, "%s.%06ld ", timestr, tv.tv_usec); \ >+ fprintf(stderr, "ROCKER: " fmt, ## __VA_ARGS__); \ >+ } while (0) > #else > static inline GCC_FMT_ATTR(1, 2) int DPRINTF(const char *fmt, ...) > { >-- >1.7.10.4 >