summaryrefslogtreecommitdiffstats
path: root/drivers/scsi/fnic
diff options
context:
space:
mode:
authorSatish Kharat <satishkh@cisco.com>2017-06-26 20:48:08 -0400
committerMartin K. Petersen <martin.petersen@oracle.com>2017-06-27 21:40:59 -0400
commit43caa03fec79d062c5f7a959a823770d72717b24 (patch)
tree5b576b2b97f8f205d111ab73583934ef1b8af969 /drivers/scsi/fnic
parent1cdf8bc18f1ee43a39e543506fff8d5db3020ae1 (diff)
scsi: fnic: added timestamp reporting in fnic debug stats
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>
Diffstat (limited to 'drivers/scsi/fnic')
-rw-r--r--drivers/scsi/fnic/fnic_debugfs.c1
-rw-r--r--drivers/scsi/fnic/fnic_stats.h7
-rw-r--r--drivers/scsi/fnic/fnic_trace.c24
3 files changed, 32 insertions, 0 deletions
diff --git a/drivers/scsi/fnic/fnic_debugfs.c b/drivers/scsi/fnic/fnic_debugfs.c
index d6498fabe628..5e3d909cfc53 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,
632 sizeof(struct io_path_stats) - sizeof(u64)); 632 sizeof(struct io_path_stats) - sizeof(u64));
633 memset(fw_stats_p+1, 0, 633 memset(fw_stats_p+1, 0,
634 sizeof(struct fw_stats) - sizeof(u64)); 634 sizeof(struct fw_stats) - sizeof(u64));
635 getnstimeofday(&stats->stats_timestamps.last_reset_time);
635 } 636 }
636 637
637 (*ppos)++; 638 (*ppos)++;
diff --git a/drivers/scsi/fnic/fnic_stats.h b/drivers/scsi/fnic/fnic_stats.h
index 88c73cccb015..e007feedbf72 100644
--- a/drivers/scsi/fnic/fnic_stats.h
+++ b/drivers/scsi/fnic/fnic_stats.h
@@ -16,6 +16,12 @@
16 */ 16 */
17#ifndef _FNIC_STATS_H_ 17#ifndef _FNIC_STATS_H_
18#define _FNIC_STATS_H_ 18#define _FNIC_STATS_H_
19
20struct stats_timestamps {
21 struct timespec last_reset_time;
22 struct timespec last_read_time;
23};
24
19struct io_path_stats { 25struct io_path_stats {
20 atomic64_t active_ios; 26 atomic64_t active_ios;
21 atomic64_t max_active_ios; 27 atomic64_t max_active_ios;
@@ -110,6 +116,7 @@ struct misc_stats {
110}; 116};
111 117
112struct fnic_stats { 118struct fnic_stats {
119 struct stats_timestamps stats_timestamps;
113 struct io_path_stats io_stats; 120 struct io_path_stats io_stats;
114 struct abort_stats abts_stats; 121 struct abort_stats abts_stats;
115 struct terminate_stats term_stats; 122 struct terminate_stats term_stats;
diff --git a/drivers/scsi/fnic/fnic_trace.c b/drivers/scsi/fnic/fnic_trace.c
index b5ac5381a0d7..4826f596cb31 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,
219 int buf_size = debug->buf_size; 219 int buf_size = debug->buf_size;
220 struct timespec val1, val2; 220 struct timespec val1, val2;
221 221
222 getnstimeofday(&val1);
222 len = snprintf(debug->debug_buffer + len, buf_size - len, 223 len = snprintf(debug->debug_buffer + len, buf_size - len,
224 "------------------------------------------\n"
225 "\t\tTime\n"
226 "------------------------------------------\n");
227
228 len += snprintf(debug->debug_buffer + len, buf_size - len,
229 "Current time : [%ld:%ld]\n"
230 "Last stats reset time: [%ld:%ld]\n"
231 "Last stats read time: [%ld:%ld]\n"
232 "delta since last reset: [%ld:%ld]\n"
233 "delta since last read: [%ld:%ld]\n",
234 val1.tv_sec, val1.tv_nsec,
235 stats->stats_timestamps.last_reset_time.tv_sec,
236 stats->stats_timestamps.last_reset_time.tv_nsec,
237 stats->stats_timestamps.last_read_time.tv_sec,
238 stats->stats_timestamps.last_read_time.tv_nsec,
239 timespec_sub(val1, stats->stats_timestamps.last_reset_time).tv_sec,
240 timespec_sub(val1, stats->stats_timestamps.last_reset_time).tv_nsec,
241 timespec_sub(val1, stats->stats_timestamps.last_read_time).tv_sec,
242 timespec_sub(val1, stats->stats_timestamps.last_read_time).tv_nsec);
243
244 stats->stats_timestamps.last_read_time = val1;
245
246 len += snprintf(debug->debug_buffer + len, buf_size - len,
223 "------------------------------------------\n" 247 "------------------------------------------\n"
224 "\t\tIO Statistics\n" 248 "\t\tIO Statistics\n"
225 "------------------------------------------\n"); 249 "------------------------------------------\n");