mirror of
https://github.com/SCST-project/scst.git
synced 2026-05-19 19:51:27 +00:00
scst, latency statistics:
- Use 64 bits instead of 32 for each "processed commands" counter. - Make sure there is at least one space between adjacent columns. git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@3884 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
@@ -31,6 +31,9 @@
|
||||
#include <linux/interrupt.h>
|
||||
#include <linux/wait.h>
|
||||
#include <linux/cpumask.h>
|
||||
#ifdef CONFIG_SCST_MEASURE_LATENCY
|
||||
#include <linux/log2.h>
|
||||
#endif
|
||||
|
||||
/* #define CONFIG_SCST_PROC */
|
||||
|
||||
@@ -1519,15 +1522,31 @@ struct scst_tgt {
|
||||
|
||||
#ifdef CONFIG_SCST_MEASURE_LATENCY
|
||||
|
||||
/* Divide two 64-bit numbers with reasonably accuracy. */
|
||||
static inline void __scst_time_per_cmd(uint64_t *t, uint64_t n)
|
||||
{
|
||||
unsigned shift;
|
||||
|
||||
if (!n)
|
||||
return;
|
||||
shift = max(0, ilog2(n) - 32 + 1);
|
||||
*t >>= shift;
|
||||
n >>= shift;
|
||||
WARN_ON(n != (uint32_t)n);
|
||||
do_div(*t, (uint32_t)n);
|
||||
}
|
||||
|
||||
#define scst_time_per_cmd(t, n) __scst_time_per_cmd(&(t), (n))
|
||||
|
||||
/* Defines extended latency statistics */
|
||||
struct scst_ext_latency_stat {
|
||||
uint64_t scst_time_rd, tgt_time_rd, dev_time_rd;
|
||||
unsigned int processed_cmds_rd;
|
||||
uint64_t processed_cmds_rd;
|
||||
uint64_t min_scst_time_rd, min_tgt_time_rd, min_dev_time_rd;
|
||||
uint64_t max_scst_time_rd, max_tgt_time_rd, max_dev_time_rd;
|
||||
|
||||
uint64_t scst_time_wr, tgt_time_wr, dev_time_wr;
|
||||
unsigned int processed_cmds_wr;
|
||||
uint64_t processed_cmds_wr;
|
||||
uint64_t min_scst_time_wr, min_tgt_time_wr, min_dev_time_wr;
|
||||
uint64_t max_scst_time_wr, max_tgt_time_wr, max_dev_time_wr;
|
||||
};
|
||||
@@ -1671,7 +1690,7 @@ struct scst_session {
|
||||
*/
|
||||
spinlock_t lat_lock;
|
||||
uint64_t scst_time, tgt_time, dev_time;
|
||||
unsigned int processed_cmds;
|
||||
uint64_t processed_cmds;
|
||||
uint64_t min_scst_time, min_tgt_time, min_dev_time;
|
||||
uint64_t max_scst_time, max_tgt_time, max_dev_time;
|
||||
struct scst_ext_latency_stat sess_latency_stat[SCST_LATENCY_STATS_NUM];
|
||||
@@ -2502,7 +2521,7 @@ struct scst_tgt_dev {
|
||||
* Protected by sess->lat_lock.
|
||||
*/
|
||||
uint64_t scst_time, tgt_time, dev_time;
|
||||
unsigned int processed_cmds;
|
||||
uint64_t processed_cmds;
|
||||
struct scst_ext_latency_stat dev_latency_stat[SCST_LATENCY_STATS_NUM];
|
||||
#endif
|
||||
};
|
||||
|
||||
@@ -482,7 +482,7 @@ static int lat_info_show(struct seq_file *seq, void *v)
|
||||
unsigned int i;
|
||||
int t;
|
||||
uint64_t scst_time, tgt_time, dev_time;
|
||||
unsigned int processed_cmds;
|
||||
uint64_t processed_cmds;
|
||||
|
||||
if (!header_printed) {
|
||||
seq_printf(seq, "%-15s %-15s %-46s %-46s %-46s\n",
|
||||
@@ -499,9 +499,9 @@ static int lat_info_show(struct seq_file *seq, void *v)
|
||||
|
||||
for (i = 0; i < SCST_LATENCY_STATS_NUM ; i++) {
|
||||
uint64_t scst_time_wr, tgt_time_wr, dev_time_wr;
|
||||
unsigned int processed_cmds_wr;
|
||||
uint64_t processed_cmds_wr;
|
||||
uint64_t scst_time_rd, tgt_time_rd, dev_time_rd;
|
||||
unsigned int processed_cmds_rd;
|
||||
uint64_t processed_cmds_rd;
|
||||
struct scst_ext_latency_stat *latency_stat;
|
||||
|
||||
latency_stat = &sess->sess_latency_stat[i];
|
||||
@@ -514,65 +514,61 @@ static int lat_info_show(struct seq_file *seq, void *v)
|
||||
processed_cmds_wr = latency_stat->processed_cmds_wr;
|
||||
processed_cmds_rd = latency_stat->processed_cmds_rd;
|
||||
|
||||
seq_printf(seq, "%-5s %-9s %-15lu ",
|
||||
seq_printf(seq, "%-5s %-9s %-15llu ",
|
||||
"Write", scst_io_size_names[i],
|
||||
(unsigned long)processed_cmds_wr);
|
||||
if (processed_cmds_wr == 0)
|
||||
processed_cmds_wr = 1;
|
||||
processed_cmds_wr);
|
||||
|
||||
do_div(scst_time_wr, processed_cmds_wr);
|
||||
scst_time_per_cmd(scst_time_wr, processed_cmds_wr);
|
||||
snprintf(buf, sizeof(buf), "%lu/%lu/%lu/%lu",
|
||||
(unsigned long)latency_stat->min_scst_time_wr,
|
||||
(unsigned long)scst_time_wr,
|
||||
(unsigned long)latency_stat->max_scst_time_wr,
|
||||
(unsigned long)latency_stat->scst_time_wr);
|
||||
seq_printf(seq, "%-47s", buf);
|
||||
seq_printf(seq, "%-46s ", buf);
|
||||
|
||||
do_div(tgt_time_wr, processed_cmds_wr);
|
||||
scst_time_per_cmd(tgt_time_wr, processed_cmds_wr);
|
||||
snprintf(buf, sizeof(buf), "%lu/%lu/%lu/%lu",
|
||||
(unsigned long)latency_stat->min_tgt_time_wr,
|
||||
(unsigned long)tgt_time_wr,
|
||||
(unsigned long)latency_stat->max_tgt_time_wr,
|
||||
(unsigned long)latency_stat->tgt_time_wr);
|
||||
seq_printf(seq, "%-47s", buf);
|
||||
seq_printf(seq, "%-46s ", buf);
|
||||
|
||||
do_div(dev_time_wr, processed_cmds_wr);
|
||||
scst_time_per_cmd(dev_time_wr, processed_cmds_wr);
|
||||
snprintf(buf, sizeof(buf), "%lu/%lu/%lu/%lu",
|
||||
(unsigned long)latency_stat->min_dev_time_wr,
|
||||
(unsigned long)dev_time_wr,
|
||||
(unsigned long)latency_stat->max_dev_time_wr,
|
||||
(unsigned long)latency_stat->dev_time_wr);
|
||||
seq_printf(seq, "%-47s\n", buf);
|
||||
seq_printf(seq, "%-46s\n", buf);
|
||||
|
||||
seq_printf(seq, "%-5s %-9s %-15lu ",
|
||||
seq_printf(seq, "%-5s %-9s %-15llu ",
|
||||
"Read", scst_io_size_names[i],
|
||||
(unsigned long)processed_cmds_rd);
|
||||
if (processed_cmds_rd == 0)
|
||||
processed_cmds_rd = 1;
|
||||
processed_cmds_rd);
|
||||
|
||||
do_div(scst_time_rd, processed_cmds_rd);
|
||||
scst_time_per_cmd(scst_time_rd, processed_cmds_rd);
|
||||
snprintf(buf, sizeof(buf), "%lu/%lu/%lu/%lu",
|
||||
(unsigned long)latency_stat->min_scst_time_rd,
|
||||
(unsigned long)scst_time_rd,
|
||||
(unsigned long)latency_stat->max_scst_time_rd,
|
||||
(unsigned long)latency_stat->scst_time_rd);
|
||||
seq_printf(seq, "%-47s", buf);
|
||||
seq_printf(seq, "%-46s ", buf);
|
||||
|
||||
do_div(tgt_time_rd, processed_cmds_rd);
|
||||
scst_time_per_cmd(tgt_time_rd, processed_cmds_rd);
|
||||
snprintf(buf, sizeof(buf), "%lu/%lu/%lu/%lu",
|
||||
(unsigned long)latency_stat->min_tgt_time_rd,
|
||||
(unsigned long)tgt_time_rd,
|
||||
(unsigned long)latency_stat->max_tgt_time_rd,
|
||||
(unsigned long)latency_stat->tgt_time_rd);
|
||||
seq_printf(seq, "%-47s", buf);
|
||||
seq_printf(seq, "%-46s ", buf);
|
||||
|
||||
do_div(dev_time_rd, processed_cmds_rd);
|
||||
scst_time_per_cmd(dev_time_rd, processed_cmds_rd);
|
||||
snprintf(buf, sizeof(buf), "%lu/%lu/%lu/%lu",
|
||||
(unsigned long)latency_stat->min_dev_time_rd,
|
||||
(unsigned long)dev_time_rd,
|
||||
(unsigned long)latency_stat->max_dev_time_rd,
|
||||
(unsigned long)latency_stat->dev_time_rd);
|
||||
seq_printf(seq, "%-47s\n", buf);
|
||||
seq_printf(seq, "%-46s\n", buf);
|
||||
}
|
||||
|
||||
for (t = SESS_TGT_DEV_LIST_HASH_SIZE-1; t >= 0; t--) {
|
||||
@@ -586,9 +582,9 @@ static int lat_info_show(struct seq_file *seq, void *v)
|
||||
|
||||
for (i = 0; i < SCST_LATENCY_STATS_NUM ; i++) {
|
||||
uint64_t scst_time_wr, tgt_time_wr, dev_time_wr;
|
||||
unsigned int processed_cmds_wr;
|
||||
uint64_t processed_cmds_wr;
|
||||
uint64_t scst_time_rd, tgt_time_rd, dev_time_rd;
|
||||
unsigned int processed_cmds_rd;
|
||||
uint64_t processed_cmds_rd;
|
||||
struct scst_ext_latency_stat *latency_stat;
|
||||
|
||||
latency_stat = &tgt_dev->dev_latency_stat[i];
|
||||
@@ -601,65 +597,63 @@ static int lat_info_show(struct seq_file *seq, void *v)
|
||||
processed_cmds_wr = latency_stat->processed_cmds_wr;
|
||||
processed_cmds_rd = latency_stat->processed_cmds_rd;
|
||||
|
||||
seq_printf(seq, "%-5s %-9s %-15lu ",
|
||||
seq_printf(seq, "%-5s %-9s %-15llu ",
|
||||
"Write", scst_io_size_names[i],
|
||||
(unsigned long)processed_cmds_wr);
|
||||
if (processed_cmds_wr == 0)
|
||||
processed_cmds_wr = 1;
|
||||
processed_cmds_wr);
|
||||
|
||||
do_div(scst_time_wr, processed_cmds_wr);
|
||||
scst_time_per_cmd(scst_time_wr, processed_cmds_wr);
|
||||
snprintf(buf, sizeof(buf), "%lu/%lu/%lu/%lu",
|
||||
(unsigned long)latency_stat->min_scst_time_wr,
|
||||
(unsigned long)scst_time_wr,
|
||||
(unsigned long)latency_stat->max_scst_time_wr,
|
||||
(unsigned long)latency_stat->scst_time_wr);
|
||||
seq_printf(seq, "%-47s", buf);
|
||||
seq_printf(seq, "%-46s ", buf);
|
||||
|
||||
do_div(tgt_time_wr, processed_cmds_wr);
|
||||
scst_time_per_cmd(tgt_time_wr, processed_cmds_wr);
|
||||
snprintf(buf, sizeof(buf), "%lu/%lu/%lu/%lu",
|
||||
(unsigned long)latency_stat->min_tgt_time_wr,
|
||||
(unsigned long)tgt_time_wr,
|
||||
(unsigned long)latency_stat->max_tgt_time_wr,
|
||||
(unsigned long)latency_stat->tgt_time_wr);
|
||||
seq_printf(seq, "%-47s", buf);
|
||||
seq_printf(seq, "%-46s ", buf);
|
||||
|
||||
do_div(dev_time_wr, processed_cmds_wr);
|
||||
scst_time_per_cmd(dev_time_wr, processed_cmds_wr);
|
||||
snprintf(buf, sizeof(buf), "%lu/%lu/%lu/%lu",
|
||||
(unsigned long)latency_stat->min_dev_time_wr,
|
||||
(unsigned long)dev_time_wr,
|
||||
(unsigned long)latency_stat->max_dev_time_wr,
|
||||
(unsigned long)latency_stat->dev_time_wr);
|
||||
seq_printf(seq, "%-47s\n", buf);
|
||||
seq_printf(seq, "%-46s\n", buf);
|
||||
|
||||
seq_printf(seq, "%-5s %-9s %-15lu ",
|
||||
seq_printf(seq, "%-5s %-9s %-15llu ",
|
||||
"Read", scst_io_size_names[i],
|
||||
(unsigned long)processed_cmds_rd);
|
||||
processed_cmds_rd);
|
||||
if (processed_cmds_rd == 0)
|
||||
processed_cmds_rd = 1;
|
||||
|
||||
do_div(scst_time_rd, processed_cmds_rd);
|
||||
scst_time_per_cmd(scst_time_rd, processed_cmds_rd);
|
||||
snprintf(buf, sizeof(buf), "%lu/%lu/%lu/%lu",
|
||||
(unsigned long)latency_stat->min_scst_time_rd,
|
||||
(unsigned long)scst_time_rd,
|
||||
(unsigned long)latency_stat->max_scst_time_rd,
|
||||
(unsigned long)latency_stat->scst_time_rd);
|
||||
seq_printf(seq, "%-47s", buf);
|
||||
seq_printf(seq, "%-46s ", buf);
|
||||
|
||||
do_div(tgt_time_rd, processed_cmds_rd);
|
||||
scst_time_per_cmd(tgt_time_rd, processed_cmds_rd);
|
||||
snprintf(buf, sizeof(buf), "%lu/%lu/%lu/%lu",
|
||||
(unsigned long)latency_stat->min_tgt_time_rd,
|
||||
(unsigned long)tgt_time_rd,
|
||||
(unsigned long)latency_stat->max_tgt_time_rd,
|
||||
(unsigned long)latency_stat->tgt_time_rd);
|
||||
seq_printf(seq, "%-47s", buf);
|
||||
seq_printf(seq, "%-46s ", buf);
|
||||
|
||||
do_div(dev_time_rd, processed_cmds_rd);
|
||||
scst_time_per_cmd(dev_time_rd, processed_cmds_rd);
|
||||
snprintf(buf, sizeof(buf), "%lu/%lu/%lu/%lu",
|
||||
(unsigned long)latency_stat->min_dev_time_rd,
|
||||
(unsigned long)dev_time_rd,
|
||||
(unsigned long)latency_stat->max_dev_time_rd,
|
||||
(unsigned long)latency_stat->dev_time_rd);
|
||||
seq_printf(seq, "%-47s\n", buf);
|
||||
seq_printf(seq, "%-46s\n", buf);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -669,35 +663,35 @@ static int lat_info_show(struct seq_file *seq, void *v)
|
||||
dev_time = sess->dev_time;
|
||||
processed_cmds = sess->processed_cmds;
|
||||
|
||||
seq_printf(seq, "\n%-15s %-16u", "Overall ",
|
||||
seq_printf(seq, "\n%-15s %-16llu", "Overall ",
|
||||
processed_cmds);
|
||||
|
||||
if (processed_cmds == 0)
|
||||
processed_cmds = 1;
|
||||
|
||||
do_div(scst_time, processed_cmds);
|
||||
scst_time_per_cmd(scst_time, processed_cmds);
|
||||
snprintf(buf, sizeof(buf), "%lu/%lu/%lu/%lu",
|
||||
(unsigned long)sess->min_scst_time,
|
||||
(unsigned long)scst_time,
|
||||
(unsigned long)sess->max_scst_time,
|
||||
(unsigned long)sess->scst_time);
|
||||
seq_printf(seq, "%-47s", buf);
|
||||
seq_printf(seq, "%-46s ", buf);
|
||||
|
||||
do_div(tgt_time, processed_cmds);
|
||||
scst_time_per_cmd(tgt_time, processed_cmds);
|
||||
snprintf(buf, sizeof(buf), "%lu/%lu/%lu/%lu",
|
||||
(unsigned long)sess->min_tgt_time,
|
||||
(unsigned long)tgt_time,
|
||||
(unsigned long)sess->max_tgt_time,
|
||||
(unsigned long)sess->tgt_time);
|
||||
seq_printf(seq, "%-47s", buf);
|
||||
seq_printf(seq, "%-46s ", buf);
|
||||
|
||||
do_div(dev_time, processed_cmds);
|
||||
scst_time_per_cmd(dev_time, processed_cmds);
|
||||
snprintf(buf, sizeof(buf), "%lu/%lu/%lu/%lu",
|
||||
(unsigned long)sess->min_dev_time,
|
||||
(unsigned long)dev_time,
|
||||
(unsigned long)sess->max_dev_time,
|
||||
(unsigned long)sess->dev_time);
|
||||
seq_printf(seq, "%-47s\n\n", buf);
|
||||
seq_printf(seq, "%-46s\n\n", buf);
|
||||
|
||||
spin_unlock_bh(&sess->lat_lock);
|
||||
}
|
||||
|
||||
@@ -2975,9 +2975,9 @@ static ssize_t scst_tgt_dev_latency_show(struct kobject *kobj,
|
||||
|
||||
for (i = 0; i < SCST_LATENCY_STATS_NUM; i++) {
|
||||
uint64_t scst_time_wr, tgt_time_wr, dev_time_wr;
|
||||
unsigned int processed_cmds_wr;
|
||||
uint64_t processed_cmds_wr;
|
||||
uint64_t scst_time_rd, tgt_time_rd, dev_time_rd;
|
||||
unsigned int processed_cmds_rd;
|
||||
uint64_t processed_cmds_rd;
|
||||
struct scst_ext_latency_stat *latency_stat;
|
||||
|
||||
latency_stat = &tgt_dev->dev_latency_stat[i];
|
||||
@@ -2991,70 +2991,66 @@ static ssize_t scst_tgt_dev_latency_show(struct kobject *kobj,
|
||||
processed_cmds_rd = latency_stat->processed_cmds_rd;
|
||||
|
||||
res += scnprintf(&buffer[res], SCST_SYSFS_BLOCK_SIZE - res,
|
||||
"%-5s %-9s %-15lu ", "Write", scst_io_size_names[i],
|
||||
(unsigned long)processed_cmds_wr);
|
||||
if (processed_cmds_wr == 0)
|
||||
processed_cmds_wr = 1;
|
||||
"%-5s %-9s %-15llu ", "Write", scst_io_size_names[i],
|
||||
processed_cmds_wr);
|
||||
|
||||
do_div(scst_time_wr, processed_cmds_wr);
|
||||
scst_time_per_cmd(scst_time_wr, processed_cmds_wr);
|
||||
snprintf(buf, sizeof(buf), "%lu/%lu/%lu/%lu",
|
||||
(unsigned long)latency_stat->min_scst_time_wr,
|
||||
(unsigned long)scst_time_wr,
|
||||
(unsigned long)latency_stat->max_scst_time_wr,
|
||||
(unsigned long)latency_stat->scst_time_wr);
|
||||
res += scnprintf(&buffer[res], SCST_SYSFS_BLOCK_SIZE - res,
|
||||
"%-47s", buf);
|
||||
"%-46s ", buf);
|
||||
|
||||
do_div(tgt_time_wr, processed_cmds_wr);
|
||||
scst_time_per_cmd(tgt_time_wr, processed_cmds_wr);
|
||||
snprintf(buf, sizeof(buf), "%lu/%lu/%lu/%lu",
|
||||
(unsigned long)latency_stat->min_tgt_time_wr,
|
||||
(unsigned long)tgt_time_wr,
|
||||
(unsigned long)latency_stat->max_tgt_time_wr,
|
||||
(unsigned long)latency_stat->tgt_time_wr);
|
||||
res += scnprintf(&buffer[res], SCST_SYSFS_BLOCK_SIZE - res,
|
||||
"%-47s", buf);
|
||||
"%-46s ", buf);
|
||||
|
||||
do_div(dev_time_wr, processed_cmds_wr);
|
||||
scst_time_per_cmd(dev_time_wr, processed_cmds_wr);
|
||||
snprintf(buf, sizeof(buf), "%lu/%lu/%lu/%lu",
|
||||
(unsigned long)latency_stat->min_dev_time_wr,
|
||||
(unsigned long)dev_time_wr,
|
||||
(unsigned long)latency_stat->max_dev_time_wr,
|
||||
(unsigned long)latency_stat->dev_time_wr);
|
||||
res += scnprintf(&buffer[res], SCST_SYSFS_BLOCK_SIZE - res,
|
||||
"%-47s\n", buf);
|
||||
"%-46s\n", buf);
|
||||
|
||||
res += scnprintf(&buffer[res], SCST_SYSFS_BLOCK_SIZE - res,
|
||||
"%-5s %-9s %-15lu ", "Read", scst_io_size_names[i],
|
||||
(unsigned long)processed_cmds_rd);
|
||||
if (processed_cmds_rd == 0)
|
||||
processed_cmds_rd = 1;
|
||||
"%-5s %-9s %-15llu ", "Read", scst_io_size_names[i],
|
||||
processed_cmds_rd);
|
||||
|
||||
do_div(scst_time_rd, processed_cmds_rd);
|
||||
scst_time_per_cmd(scst_time_rd, processed_cmds_rd);
|
||||
snprintf(buf, sizeof(buf), "%lu/%lu/%lu/%lu",
|
||||
(unsigned long)latency_stat->min_scst_time_rd,
|
||||
(unsigned long)scst_time_rd,
|
||||
(unsigned long)latency_stat->max_scst_time_rd,
|
||||
(unsigned long)latency_stat->scst_time_rd);
|
||||
res += scnprintf(&buffer[res], SCST_SYSFS_BLOCK_SIZE - res,
|
||||
"%-47s", buf);
|
||||
"%-46s ", buf);
|
||||
|
||||
do_div(tgt_time_rd, processed_cmds_rd);
|
||||
scst_time_per_cmd(tgt_time_rd, processed_cmds_rd);
|
||||
snprintf(buf, sizeof(buf), "%lu/%lu/%lu/%lu",
|
||||
(unsigned long)latency_stat->min_tgt_time_rd,
|
||||
(unsigned long)tgt_time_rd,
|
||||
(unsigned long)latency_stat->max_tgt_time_rd,
|
||||
(unsigned long)latency_stat->tgt_time_rd);
|
||||
res += scnprintf(&buffer[res], SCST_SYSFS_BLOCK_SIZE - res,
|
||||
"%-47s", buf);
|
||||
"%-46s ", buf);
|
||||
|
||||
do_div(dev_time_rd, processed_cmds_rd);
|
||||
scst_time_per_cmd(dev_time_rd, processed_cmds_rd);
|
||||
snprintf(buf, sizeof(buf), "%lu/%lu/%lu/%lu",
|
||||
(unsigned long)latency_stat->min_dev_time_rd,
|
||||
(unsigned long)dev_time_rd,
|
||||
(unsigned long)latency_stat->max_dev_time_rd,
|
||||
(unsigned long)latency_stat->dev_time_rd);
|
||||
res += scnprintf(&buffer[res], SCST_SYSFS_BLOCK_SIZE - res,
|
||||
"%-47s\n", buf);
|
||||
"%-46s\n", buf);
|
||||
}
|
||||
|
||||
TRACE_EXIT_RES(res);
|
||||
@@ -3181,7 +3177,7 @@ static ssize_t scst_sess_latency_show(struct kobject *kobj,
|
||||
int i;
|
||||
char buf[50];
|
||||
uint64_t scst_time, tgt_time, dev_time;
|
||||
unsigned int processed_cmds;
|
||||
uint64_t processed_cmds;
|
||||
|
||||
TRACE_ENTRY();
|
||||
|
||||
@@ -3196,9 +3192,9 @@ static ssize_t scst_sess_latency_show(struct kobject *kobj,
|
||||
|
||||
for (i = 0; i < SCST_LATENCY_STATS_NUM ; i++) {
|
||||
uint64_t scst_time_wr, tgt_time_wr, dev_time_wr;
|
||||
unsigned int processed_cmds_wr;
|
||||
uint64_t processed_cmds_wr;
|
||||
uint64_t scst_time_rd, tgt_time_rd, dev_time_rd;
|
||||
unsigned int processed_cmds_rd;
|
||||
uint64_t processed_cmds_rd;
|
||||
struct scst_ext_latency_stat *latency_stat;
|
||||
|
||||
latency_stat = &sess->sess_latency_stat[i];
|
||||
@@ -3212,72 +3208,68 @@ static ssize_t scst_sess_latency_show(struct kobject *kobj,
|
||||
processed_cmds_rd = latency_stat->processed_cmds_rd;
|
||||
|
||||
res += scnprintf(&buffer[res], SCST_SYSFS_BLOCK_SIZE - res,
|
||||
"%-5s %-9s %-15lu ",
|
||||
"%-5s %-9s %-15llu ",
|
||||
"Write", scst_io_size_names[i],
|
||||
(unsigned long)processed_cmds_wr);
|
||||
if (processed_cmds_wr == 0)
|
||||
processed_cmds_wr = 1;
|
||||
processed_cmds_wr);
|
||||
|
||||
do_div(scst_time_wr, processed_cmds_wr);
|
||||
scst_time_per_cmd(scst_time_wr, processed_cmds_wr);
|
||||
snprintf(buf, sizeof(buf), "%lu/%lu/%lu/%lu",
|
||||
(unsigned long)latency_stat->min_scst_time_wr,
|
||||
(unsigned long)scst_time_wr,
|
||||
(unsigned long)latency_stat->max_scst_time_wr,
|
||||
(unsigned long)latency_stat->scst_time_wr);
|
||||
res += scnprintf(&buffer[res], SCST_SYSFS_BLOCK_SIZE - res,
|
||||
"%-47s", buf);
|
||||
"%-46s ", buf);
|
||||
|
||||
do_div(tgt_time_wr, processed_cmds_wr);
|
||||
scst_time_per_cmd(tgt_time_wr, processed_cmds_wr);
|
||||
snprintf(buf, sizeof(buf), "%lu/%lu/%lu/%lu",
|
||||
(unsigned long)latency_stat->min_tgt_time_wr,
|
||||
(unsigned long)tgt_time_wr,
|
||||
(unsigned long)latency_stat->max_tgt_time_wr,
|
||||
(unsigned long)latency_stat->tgt_time_wr);
|
||||
res += scnprintf(&buffer[res], SCST_SYSFS_BLOCK_SIZE - res,
|
||||
"%-47s", buf);
|
||||
"%-46s ", buf);
|
||||
|
||||
do_div(dev_time_wr, processed_cmds_wr);
|
||||
scst_time_per_cmd(dev_time_wr, processed_cmds_wr);
|
||||
snprintf(buf, sizeof(buf), "%lu/%lu/%lu/%lu",
|
||||
(unsigned long)latency_stat->min_dev_time_wr,
|
||||
(unsigned long)dev_time_wr,
|
||||
(unsigned long)latency_stat->max_dev_time_wr,
|
||||
(unsigned long)latency_stat->dev_time_wr);
|
||||
res += scnprintf(&buffer[res], SCST_SYSFS_BLOCK_SIZE - res,
|
||||
"%-47s\n", buf);
|
||||
"%-46s\n", buf);
|
||||
|
||||
res += scnprintf(&buffer[res], SCST_SYSFS_BLOCK_SIZE - res,
|
||||
"%-5s %-9s %-15lu ",
|
||||
"%-5s %-9s %-15llu ",
|
||||
"Read", scst_io_size_names[i],
|
||||
(unsigned long)processed_cmds_rd);
|
||||
if (processed_cmds_rd == 0)
|
||||
processed_cmds_rd = 1;
|
||||
processed_cmds_rd);
|
||||
|
||||
do_div(scst_time_rd, processed_cmds_rd);
|
||||
scst_time_per_cmd(scst_time_rd, processed_cmds_rd);
|
||||
snprintf(buf, sizeof(buf), "%lu/%lu/%lu/%lu",
|
||||
(unsigned long)latency_stat->min_scst_time_rd,
|
||||
(unsigned long)scst_time_rd,
|
||||
(unsigned long)latency_stat->max_scst_time_rd,
|
||||
(unsigned long)latency_stat->scst_time_rd);
|
||||
res += scnprintf(&buffer[res], SCST_SYSFS_BLOCK_SIZE - res,
|
||||
"%-47s", buf);
|
||||
"%-46s ", buf);
|
||||
|
||||
do_div(tgt_time_rd, processed_cmds_rd);
|
||||
scst_time_per_cmd(tgt_time_rd, processed_cmds_rd);
|
||||
snprintf(buf, sizeof(buf), "%lu/%lu/%lu/%lu",
|
||||
(unsigned long)latency_stat->min_tgt_time_rd,
|
||||
(unsigned long)tgt_time_rd,
|
||||
(unsigned long)latency_stat->max_tgt_time_rd,
|
||||
(unsigned long)latency_stat->tgt_time_rd);
|
||||
res += scnprintf(&buffer[res], SCST_SYSFS_BLOCK_SIZE - res,
|
||||
"%-47s", buf);
|
||||
"%-46s ", buf);
|
||||
|
||||
do_div(dev_time_rd, processed_cmds_rd);
|
||||
scst_time_per_cmd(dev_time_rd, processed_cmds_rd);
|
||||
snprintf(buf, sizeof(buf), "%lu/%lu/%lu/%lu",
|
||||
(unsigned long)latency_stat->min_dev_time_rd,
|
||||
(unsigned long)dev_time_rd,
|
||||
(unsigned long)latency_stat->max_dev_time_rd,
|
||||
(unsigned long)latency_stat->dev_time_rd);
|
||||
res += scnprintf(&buffer[res], SCST_SYSFS_BLOCK_SIZE - res,
|
||||
"%-47s\n", buf);
|
||||
"%-46s\n", buf);
|
||||
}
|
||||
|
||||
scst_time = sess->scst_time;
|
||||
@@ -3286,37 +3278,34 @@ static ssize_t scst_sess_latency_show(struct kobject *kobj,
|
||||
processed_cmds = sess->processed_cmds;
|
||||
|
||||
res += scnprintf(&buffer[res], SCST_SYSFS_BLOCK_SIZE - res,
|
||||
"\n%-15s %-16u", "Overall ", processed_cmds);
|
||||
"\n%-15s %-16llu", "Overall ", processed_cmds);
|
||||
|
||||
if (processed_cmds == 0)
|
||||
processed_cmds = 1;
|
||||
|
||||
do_div(scst_time, processed_cmds);
|
||||
scst_time_per_cmd(scst_time, processed_cmds);
|
||||
snprintf(buf, sizeof(buf), "%lu/%lu/%lu/%lu",
|
||||
(unsigned long)sess->min_scst_time,
|
||||
(unsigned long)scst_time,
|
||||
(unsigned long)sess->max_scst_time,
|
||||
(unsigned long)sess->scst_time);
|
||||
res += scnprintf(&buffer[res], SCST_SYSFS_BLOCK_SIZE - res,
|
||||
"%-47s", buf);
|
||||
"%-46s ", buf);
|
||||
|
||||
do_div(tgt_time, processed_cmds);
|
||||
scst_time_per_cmd(tgt_time, processed_cmds);
|
||||
snprintf(buf, sizeof(buf), "%lu/%lu/%lu/%lu",
|
||||
(unsigned long)sess->min_tgt_time,
|
||||
(unsigned long)tgt_time,
|
||||
(unsigned long)sess->max_tgt_time,
|
||||
(unsigned long)sess->tgt_time);
|
||||
res += scnprintf(&buffer[res], SCST_SYSFS_BLOCK_SIZE - res,
|
||||
"%-47s", buf);
|
||||
"%-46s ", buf);
|
||||
|
||||
do_div(dev_time, processed_cmds);
|
||||
scst_time_per_cmd(dev_time, processed_cmds);
|
||||
snprintf(buf, sizeof(buf), "%lu/%lu/%lu/%lu",
|
||||
(unsigned long)sess->min_dev_time,
|
||||
(unsigned long)dev_time,
|
||||
(unsigned long)sess->max_dev_time,
|
||||
(unsigned long)sess->dev_time);
|
||||
res += scnprintf(&buffer[res], SCST_SYSFS_BLOCK_SIZE - res,
|
||||
"%-47s\n\n", buf);
|
||||
"%-46s\n\n", buf);
|
||||
|
||||
spin_unlock_bh(&sess->lat_lock);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user