From patchwork Fri Oct 22 20:15:58 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arlin Davis X-Patchwork-Id: 277801 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id o9MKGMK7031863 for ; Fri, 22 Oct 2010 20:16:22 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759271Ab0JVUQB (ORCPT ); Fri, 22 Oct 2010 16:16:01 -0400 Received: from mga09.intel.com ([134.134.136.24]:47875 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1759306Ab0JVUP7 convert rfc822-to-8bit (ORCPT ); Fri, 22 Oct 2010 16:15:59 -0400 Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga102.jf.intel.com with ESMTP; 22 Oct 2010 13:15:59 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.58,224,1286175600"; d="scan'208";a="566584470" Received: from orsmsx604.amr.corp.intel.com ([10.22.226.87]) by orsmga002.jf.intel.com with ESMTP; 22 Oct 2010 13:15:59 -0700 Received: from orsmsx601.amr.corp.intel.com (10.22.226.213) by orsmsx604.amr.corp.intel.com (10.22.226.87) with Microsoft SMTP Server (TLS) id 8.2.254.0; Fri, 22 Oct 2010 13:15:58 -0700 Received: from orsmsx506.amr.corp.intel.com ([10.22.226.44]) by orsmsx601.amr.corp.intel.com ([10.22.226.213]) with mapi; Fri, 22 Oct 2010 13:15:58 -0700 From: "Davis, Arlin R" To: linux-rdma , "ofw@lists.openfabrics.org" Date: Fri, 22 Oct 2010 13:15:58 -0700 Subject: [PATCH] DAPL v2.0: add high resolution time stamps and thread id to sdtout debug logs Thread-Topic: [PATCH] DAPL v2.0: add high resolution time stamps and thread id to sdtout debug logs Thread-Index: ActyJfBbuw+dWPO6RX+fAax45A3sxQ== Message-ID: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: acceptlanguage: en-US MIME-Version: 1.0 Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter1.kernel.org [140.211.167.41]); Fri, 22 Oct 2010 20:16:22 +0000 (UTC) diff --git a/dapl/common/dapl_debug.c b/dapl/common/dapl_debug.c index 904d075..e1a940c 100644 --- a/dapl/common/dapl_debug.c +++ b/dapl/common/dapl_debug.c @@ -36,6 +36,8 @@ DAPL_DBG_DEST g_dapl_dbg_dest; /* initialized in dapl_init.c */ static char *_ptr_host_ = NULL; static char _hostname_[128]; +static DAPL_OS_TIMEVAL start_t, current_t, last_t; /* microsecond timeStamp STDOUT */ +static int delta_t, total_t; void dapl_internal_dbg_log(DAPL_DBG_TYPE type, const char *fmt, ...) { @@ -44,13 +46,20 @@ void dapl_internal_dbg_log(DAPL_DBG_TYPE type, const char *fmt, ...) if (_ptr_host_ == NULL) { gethostname(_hostname_, sizeof(_hostname_)); _ptr_host_ = _hostname_; + dapl_os_get_time(&start_t); + last_t = start_t; } + dapl_os_get_time(¤t_t); + delta_t = current_t - last_t; + total_t = current_t - start_t; + last_t = current_t; if (type & g_dapl_dbg_type) { if (DAPL_DBG_DEST_STDOUT & g_dapl_dbg_dest) { va_start(args, fmt); - fprintf(stdout, "%s:%x: ", _ptr_host_, - dapl_os_getpid()); + fprintf(stdout, "%s:%x:%x: %d us(%d us%s): ", + _ptr_host_, dapl_os_getpid(), dapl_os_gettid(), + total_t, delta_t, delta_t > 500000 ? "!!!":""); dapl_os_vprintf(fmt, args); va_end(args); }