From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52694) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YNTVn-0000XX-Lc for qemu-devel@nongnu.org; Mon, 16 Feb 2015 16:47:33 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YNTVh-0001O4-ER for qemu-devel@nongnu.org; Mon, 16 Feb 2015 16:47:27 -0500 Received: from mail-pd0-f179.google.com ([209.85.192.179]:36196) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YNTVh-0001Nm-9s for qemu-devel@nongnu.org; Mon, 16 Feb 2015 16:47:21 -0500 Received: by pdjp10 with SMTP id p10so39096642pdj.3 for ; Mon, 16 Feb 2015 13:47:20 -0800 (PST) From: sfeldma@gmail.com Date: Mon, 16 Feb 2015 13:47:51 -0800 Message-Id: <1424123271-7656-11-git-send-email-sfeldma@gmail.com> In-Reply-To: <1424123271-7656-1-git-send-email-sfeldma@gmail.com> References: <1424123271-7656-1-git-send-email-sfeldma@gmail.com> Subject: [Qemu-devel] [PATCH v7 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