From patchwork Tue Jun 27 00:48:08 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Satish Kharat X-Patchwork-Id: 9810649 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id D027F603D7 for ; Tue, 27 Jun 2017 00:58:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DA9D827F88 for ; Tue, 27 Jun 2017 00:57:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CED50283A5; Tue, 27 Jun 2017 00:57:59 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-14.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_HI, USER_IN_DEF_DKIM_WL autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 395FB27F88 for ; Tue, 27 Jun 2017 00:57:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751490AbdF0A55 (ORCPT ); Mon, 26 Jun 2017 20:57:57 -0400 Received: from rcdn-iport-3.cisco.com ([173.37.86.74]:9920 "EHLO rcdn-iport-3.cisco.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751480AbdF0A5w (ORCPT ); Mon, 26 Jun 2017 20:57:52 -0400 X-Greylist: delayed 571 seconds by postgrey-1.27 at vger.kernel.org; Mon, 26 Jun 2017 20:57:52 EDT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=cisco.com; i=@cisco.com; l=3271; q=dns/txt; s=iport; t=1498525072; x=1499734672; h=from:to:cc:subject:date:message-id; bh=8QwZ2UGkqsgs65jt0l0S+4DF8oHQAWcLq539yF4zk6Y=; b=iefL/pyxLdPxooEYEswRyMlN0/lo+KQF+TR6k+eFEcMyeYg0xdTjyzJj slqXxOp6cLsUTbDOZ/+4QTEmSd+JDggMFapEsEiLq/0804crN0FBO0JzV Ab4Rm4hF+RuD/oz3TfH475k9QgaJSUfkC6dTVKm1D2dLzAp/8Dnb5XIxe 0=; X-IronPort-AV: E=Sophos;i="5.39,398,1493683200"; d="scan'208";a="252386913" Received: from rcdn-core-7.cisco.com ([173.37.93.143]) by rcdn-iport-3.cisco.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 27 Jun 2017 00:48:20 +0000 Received: from satishkh.cisco.com ([10.157.132.70]) by rcdn-core-7.cisco.com (8.14.5/8.14.5) with ESMTP id v5R0mKDF007701; Tue, 27 Jun 2017 00:48:20 GMT From: Satish Kharat To: linux-scsi@vger.kernel.org Cc: satishkh@cisco.com, Sesidhar Baddela Subject: [PATCH 1/1] fnic:added timestamp reporting in fnic debug stats Date: Mon, 26 Jun 2017 17:48:08 -0700 Message-Id: <1498524488-32453-1-git-send-email-satishkh@cisco.com> X-Mailer: git-send-email 2.5.5 Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Added the timestamps for 1. current timestamp 2. last fnic stats read timestamp 3. last fnic stats reset timestamp and the deltas since last stats read and last reset in fnic stats. fnic stats uses debugfs Signed-off-by: Sesidhar Baddela Signed-off-by: Satish Kharat --- drivers/scsi/fnic/fnic_debugfs.c | 1 + drivers/scsi/fnic/fnic_stats.h | 7 +++++++ drivers/scsi/fnic/fnic_trace.c | 24 ++++++++++++++++++++++++ 3 files changed, 32 insertions(+) diff --git a/drivers/scsi/fnic/fnic_debugfs.c b/drivers/scsi/fnic/fnic_debugfs.c index d6498fa..5e3d909 100644 --- a/drivers/scsi/fnic/fnic_debugfs.c +++ b/drivers/scsi/fnic/fnic_debugfs.c @@ -632,6 +632,7 @@ static ssize_t fnic_reset_stats_write(struct file *file, sizeof(struct io_path_stats) - sizeof(u64)); memset(fw_stats_p+1, 0, sizeof(struct fw_stats) - sizeof(u64)); + getnstimeofday(&stats->stats_timestamps.last_reset_time); } (*ppos)++; diff --git a/drivers/scsi/fnic/fnic_stats.h b/drivers/scsi/fnic/fnic_stats.h index 88c73cc..e007fee 100644 --- a/drivers/scsi/fnic/fnic_stats.h +++ b/drivers/scsi/fnic/fnic_stats.h @@ -16,6 +16,12 @@ */ #ifndef _FNIC_STATS_H_ #define _FNIC_STATS_H_ + +struct stats_timestamps { + struct timespec last_reset_time; + struct timespec last_read_time; +}; + struct io_path_stats { atomic64_t active_ios; atomic64_t max_active_ios; @@ -110,6 +116,7 @@ struct misc_stats { }; struct fnic_stats { + struct stats_timestamps stats_timestamps; struct io_path_stats io_stats; struct abort_stats abts_stats; struct terminate_stats term_stats; diff --git a/drivers/scsi/fnic/fnic_trace.c b/drivers/scsi/fnic/fnic_trace.c index b5ac538..4826f59 100644 --- a/drivers/scsi/fnic/fnic_trace.c +++ b/drivers/scsi/fnic/fnic_trace.c @@ -219,7 +219,31 @@ int fnic_get_stats_data(struct stats_debug_info *debug, int buf_size = debug->buf_size; struct timespec val1, val2; + getnstimeofday(&val1); len = snprintf(debug->debug_buffer + len, buf_size - len, + "------------------------------------------\n" + "\t\tTime\n" + "------------------------------------------\n"); + + len += snprintf(debug->debug_buffer + len, buf_size - len, + "Current time : [%ld:%ld]\n" + "Last stats reset time: [%ld:%ld]\n" + "Last stats read time: [%ld:%ld]\n" + "delta since last reset: [%ld:%ld]\n" + "delta since last read: [%ld:%ld]\n", + val1.tv_sec, val1.tv_nsec, + stats->stats_timestamps.last_reset_time.tv_sec, + stats->stats_timestamps.last_reset_time.tv_nsec, + stats->stats_timestamps.last_read_time.tv_sec, + stats->stats_timestamps.last_read_time.tv_nsec, + timespec_sub(val1, stats->stats_timestamps.last_reset_time).tv_sec, + timespec_sub(val1, stats->stats_timestamps.last_reset_time).tv_nsec, + timespec_sub(val1, stats->stats_timestamps.last_read_time).tv_sec, + timespec_sub(val1, stats->stats_timestamps.last_read_time).tv_nsec); + + stats->stats_timestamps.last_read_time = val1; + + len += snprintf(debug->debug_buffer + len, buf_size - len, "------------------------------------------\n" "\t\tIO Statistics\n" "------------------------------------------\n");