[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-block] [PATCH 2/3] block/accounting: introduce block size hist
From: |
Vladimir Sementsov-Ogievskiy |
Subject: |
Re: [Qemu-block] [PATCH 2/3] block/accounting: introduce block size histogram |
Date: |
Fri, 21 Jun 2019 09:48:56 +0000 |
20.06.2019 11:54, zhenwei pi wrote:
> 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 <address@hidden>
> ---
> block/accounting.c | 24 ++++++++++++++++++++++++
> include/block/accounting.h | 4 ++++
> 2 files changed, 28 insertions(+)
>
> diff --git a/block/accounting.c b/block/accounting.c
> index bb8148b6b1..94d5aa292e 100644
> --- a/block/accounting.c
> +++ b/block/accounting.c
> @@ -187,6 +187,27 @@ 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++) {
> + BlockHistogram *hist = &stats->size_histogram[i];
> + g_free(hist->bins);
> + g_free(hist->boundaries);
> + memset(hist, 0, sizeof(*hist));
And this is the duplication I've told about in 01
> + }
> +}
> +
> +
> static void block_account_one_io(BlockAcctStats *stats, BlockAcctCookie
> *cookie,
> bool failed)
> {
> @@ -211,6 +232,9 @@ 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..49d3a78f48 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,8 @@ 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);
Hmm, uncommon indentation you use. In Qemu the second line of parameters should
start
at the position of first symbol after '(', like this:
int block_size_histogram_set(BlockAcctStats *stats, enum BlockAcctType type,
uint64List *boundaries);
> +void block_size_histograms_clear(BlockAcctStats *stats);
>
> #endif
>
--
Best regards,
Vladimir