From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35688) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YJGK5-00029W-DW for qemu-devel@nongnu.org; Thu, 05 Feb 2015 01:53:58 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YJGK0-0006wY-MP for qemu-devel@nongnu.org; Thu, 05 Feb 2015 01:53:57 -0500 Received: from mail-pd0-f177.google.com ([209.85.192.177]:44525) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YJGK0-0006wT-I6 for qemu-devel@nongnu.org; Thu, 05 Feb 2015 01:53:52 -0500 Received: by pdbft15 with SMTP id ft15so5922523pdb.11 for ; Wed, 04 Feb 2015 22:53:52 -0800 (PST) From: sfeldma@gmail.com Date: Wed, 4 Feb 2015 22:54:21 -0800 Message-Id: <1423119261-60904-11-git-send-email-sfeldma@gmail.com> In-Reply-To: <1423119261-60904-1-git-send-email-sfeldma@gmail.com> References: <1423119261-60904-1-git-send-email-sfeldma@gmail.com> Subject: [Qemu-devel] [PATCH v6 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: qemu-devel@nongnu.org, jiri@resnulli.us, roopa@cumulusnetworks.com, john.fastabend@gmail.com, eblake@redhat.com, pbonzini@redhat.com, stefanha@gmail.com, dsahern@gmail.com, jasowang@redhat.com 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