[Devel] [PATCH RH8 3/3] target: add read/write/sync latency counter
Andrey Zhadchenko
andrey.zhadchenko at virtuozzo.com
Mon Apr 26 10:18:13 MSK 2021
From: Andrey Grafin <Andrey.Grafin at acronis.com>
This patch adds latency counter for write/read/sync operation for LUN.
This value can be obtain from histogram file (as the second line of output):
cat /sys/kernel/config/target/iscsi/iqn.2003-01.org.linux-iscsi.localhost.x8664\:sn.fdee138936b9/tpgt_1/lun/lun_3/statistics/scsi_tgt_port/read_hist
1 0 0 0 9 0 2 0 0 1 4 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
118807
Signed-off-by: Andrey Grafin <Andrey.Grafin at acronis.com>
Acked-by: Andrei Vagin <avagin at virtuozzo.com>
(cherry picked from 0b0a62fe95e7c8ebf76d3b2ddeb47bfba199a302)
Signed-off-by: Andrey Zhadchenko <andrey.zhadchenko at virtuozzo.com>
---
drivers/target/target_core_stat.c | 4 ++++
include/target/target_core_base.h | 1 +
2 files changed, 5 insertions(+)
diff --git a/drivers/target/target_core_stat.c b/drivers/target/target_core_stat.c
index 07ce36e..abe7f61 100644
--- a/drivers/target/target_core_stat.c
+++ b/drivers/target/target_core_stat.c
@@ -632,6 +632,7 @@ void scsi_port_stats_hist_observe(
return;
scsi_port_stats_hist_observe_bsearch(hist, val);
+ atomic64_add(val, &hist->latencies);
}
static ssize_t find_token(const char *page, size_t size,
@@ -725,6 +726,9 @@ static ssize_t snprintf_histogram(char *page, size_t size,
ret += snprintf(page + ret, PAGE_SIZE - ret,
"%llu\n", (u64)atomic64_read(&hist->counters[i]));
+ ret += snprintf(page + ret, PAGE_SIZE - ret,
+ "%llu\n", (u64)atomic64_read(&hist->latencies));
+
return ret;
}
diff --git a/include/target/target_core_base.h b/include/target/target_core_base.h
index 82a87ce..2622fd6 100644
--- a/include/target/target_core_base.h
+++ b/include/target/target_core_base.h
@@ -719,6 +719,7 @@ struct scsi_port_stats_hist {
u64 items[TCM_SE_PORT_STATS_HIST_MAX];
atomic64_t counters[TCM_SE_PORT_STATS_HIST_MAX];
u8 count;
+ atomic64_t latencies;
struct rcu_head rcu_head;
};
--
1.8.3.1
More information about the Devel
mailing list