From: zhenwei pi <pizhenwei@bytedance.com>
To: kwolf@redhat.com, vsementsov@virtuozzo.com, eblake@redhat.com
Cc: qemu-devel@nongnu.org, qemu-block@nongnu.org,
pizhenwei@bytedance.com, mreitz@redhat.com
Subject: [Qemu-devel] [PATCH v2 2/3] block/accounting: introduce block size histogram
Date: Mon, 8 Jul 2019 17:32:28 +0800 [thread overview]
Message-ID: <1562578349-12333-3-git-send-email-pizhenwei@bytedance.com> (raw)
In-Reply-To: <1562578349-12333-1-git-send-email-pizhenwei@bytedance.com>
Introduce block size histogram statics for block devices.
For read/write/flush operation type, the block size region
[0, +inf) is divided into subregions by several points.
It works like block latency histogram.
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
---
block/accounting.c | 18 ++++++++++++++++++
include/block/accounting.h | 5 ++++-
2 files changed, 22 insertions(+), 1 deletion(-)
diff --git a/block/accounting.c b/block/accounting.c
index d210a73fe9..3a1e41a971 100644
--- a/block/accounting.c
+++ b/block/accounting.c
@@ -192,6 +192,22 @@ void block_latency_histograms_clear(BlockAcctStats *stats)
}
}
+int block_size_histogram_set(BlockAcctStats *stats, enum BlockAcctType type,
+ uint64List *boundaries)
+{
+ BlockHistogram *hist = &stats->size_histogram[type];
+
+ return block_histogram_set(hist, boundaries);
+}
+
+void block_size_histograms_clear(BlockAcctStats *stats)
+{
+ int i;
+
+ for (i = 0; i < BLOCK_MAX_IOTYPE; i++) {
+ block_histogram_clear(&stats->size_histogram[i]);
+ }
+}
static void block_account_one_io(BlockAcctStats *stats, BlockAcctCookie *cookie,
bool failed)
{
@@ -216,6 +232,8 @@ static void block_account_one_io(BlockAcctStats *stats, BlockAcctCookie *cookie,
block_histogram_account(&stats->latency_histogram[cookie->type],
latency_ns);
+ block_histogram_account(&stats->size_histogram[cookie->type],
+ cookie->bytes);
if (!failed || stats->account_failed) {
stats->total_time_ns[cookie->type] += latency_ns;
diff --git a/include/block/accounting.h b/include/block/accounting.h
index 270fddb69c..0fbba64408 100644
--- a/include/block/accounting.h
+++ b/include/block/accounting.h
@@ -89,6 +89,7 @@ struct BlockAcctStats {
bool account_invalid;
bool account_failed;
BlockHistogram latency_histogram[BLOCK_MAX_IOTYPE];
+ BlockHistogram size_histogram[BLOCK_MAX_IOTYPE];
};
typedef struct BlockAcctCookie {
@@ -117,5 +118,7 @@ double block_acct_queue_depth(BlockAcctTimedStats *stats,
int block_latency_histogram_set(BlockAcctStats *stats, enum BlockAcctType type,
uint64List *boundaries);
void block_latency_histograms_clear(BlockAcctStats *stats);
-
+int block_size_histogram_set(BlockAcctStats *stats, enum BlockAcctType type,
+ uint64List *boundaries);
+void block_size_histograms_clear(BlockAcctStats *stats);
#endif
--
2.11.0
next prev parent reply other threads:[~2019-07-08 9:38 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-08 9:32 [Qemu-devel] [PATCH v2 0/3] Add block size histogram qapi interface zhenwei pi
2019-07-08 9:32 ` [Qemu-devel] [PATCH v2 1/3] block/accounting: rename struct BlockLatencyHistogram zhenwei pi
2019-07-08 9:32 ` zhenwei pi [this message]
2019-07-08 9:32 ` [Qemu-devel] [PATCH v2 3/3] qapi: make block histogram interface common zhenwei pi
2019-07-25 11:53 ` Vladimir Sementsov-Ogievskiy
-- strict thread matches above, loose matches on Subject: below --
2019-06-24 6:49 [Qemu-devel] [PATCH V2 0/3] Add block size histogram qapi interface zhenwei pi
2019-06-24 6:49 ` [Qemu-devel] [PATCH V2 2/3] block/accounting: introduce block size histogram zhenwei pi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1562578349-12333-3-git-send-email-pizhenwei@bytedance.com \
--to=pizhenwei@bytedance.com \
--cc=eblake@redhat.com \
--cc=kwolf@redhat.com \
--cc=mreitz@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=vsementsov@virtuozzo.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).