]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
scsi: fnic: added timestamp reporting in fnic debug stats
authorSatish Kharat <satishkh@cisco.com>
Tue, 27 Jun 2017 00:48:08 +0000 (17:48 -0700)
committerJack Vogel <jack.vogel@oracle.com>
Wed, 7 Mar 2018 04:09:51 +0000 (20:09 -0800)
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 <sebaddel@cisco.com>
Signed-off-by: Satish Kharat <satishkh@cisco.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from commit 43caa03fec79d062c5f7a959a823770d72717b24)

Orabug: 27587343
Signed-off-by: Jack Vogel <jack.vogel@oracle.com>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/fnic/fnic_debugfs.c
drivers/scsi/fnic/fnic_stats.h
drivers/scsi/fnic/fnic_trace.c

index 1f21da7cb3b5fb601dd8c5be2d934e41e3603cf0..a437603f52c68d7fe5735809ada9cf5c4edf2a0d 100644 (file)
@@ -633,6 +633,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)++;
index 88c73cccb01511a403a6374b703c4e6263e6d483..e007feedbf724e2990f066da1232e75c3a4f224f 100644 (file)
  */
 #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;
index df4aa89757d6354fd457e13354b2a94c6620b986..8db413198f2e69dc059d6c09b282cacd958f33d5 100644 (file)
@@ -218,7 +218,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");