From patchwork Thu Mar 12 12:19:57 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Hajnoczi X-Patchwork-Id: 449432 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 9F54F1400DE for ; Thu, 12 Mar 2015 23:23:27 +1100 (AEDT) Received: from localhost ([::1]:59684 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YW297-00048w-6A for incoming@patchwork.ozlabs.org; Thu, 12 Mar 2015 08:23:25 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39881) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YW26T-0007kr-2t for qemu-devel@nongnu.org; Thu, 12 Mar 2015 08:20:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YW26N-0007WP-DC for qemu-devel@nongnu.org; Thu, 12 Mar 2015 08:20:40 -0400 Received: from mx1.redhat.com ([209.132.183.28]:57041) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YW26M-0007WH-KW for qemu-devel@nongnu.org; Thu, 12 Mar 2015 08:20:35 -0400 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id t2CCKUeY008577 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 12 Mar 2015 08:20:30 -0400 Received: from localhost (ovpn-112-81.ams2.redhat.com [10.36.112.81]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t2CCKTcE022963; Thu, 12 Mar 2015 08:20:29 -0400 From: Stefan Hajnoczi To: Date: Thu, 12 Mar 2015 12:19:57 +0000 Message-Id: <1426162797-27548-14-git-send-email-stefanha@redhat.com> In-Reply-To: <1426162797-27548-1-git-send-email-stefanha@redhat.com> References: <1426162797-27548-1-git-send-email-stefanha@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.26 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: Jiri Pirko , Peter Maydell , Scott Feldman , Stefan Hajnoczi , David Ahern Subject: [Qemu-devel] [PULL v3 13/13] rocker: timestamp on the debug logs helps correlate with events in the VM X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: David Ahern Signed-off-by: David Ahern Signed-off-by: Scott Feldman Signed-off-by: Jiri Pirko Message-id: 1424123271-7656-11-git-send-email-sfeldma@gmail.com Signed-off-by: Stefan Hajnoczi --- 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 6ae74ff..b3310b6 100644 --- a/hw/net/rocker/rocker.h +++ b/hw/net/rocker/rocker.h @@ -23,7 +23,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, ...) {