Merge pull request #810 from mmichal10/pt-stats

Introduce pass-through block stats
This commit is contained in:
Robert Baldyga 2024-09-06 15:33:23 +02:00 committed by GitHub
commit 193410e7b2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 62 additions and 0 deletions

View File

@ -1,5 +1,6 @@
/*
* Copyright(c) 2012-2021 Intel Corporation
* Copyright(c) 2024 Huawei Technologies
* SPDX-License-Identifier: BSD-3-Clause
*/
@ -118,6 +119,9 @@ struct ocf_stats_blocks {
struct ocf_stat volume_rd;
struct ocf_stat volume_wr;
struct ocf_stat volume_total;
struct ocf_stat pass_through_rd;
struct ocf_stat pass_through_wr;
struct ocf_stat pass_through_total;
};
/**

View File

@ -1,5 +1,6 @@
/*
* Copyright(c) 2012-2022 Intel Corporation
* Copyright(c) 2024 Huawei Technologies
* SPDX-License-Identifier: BSD-3-Clause
*/
#include "ocf/ocf.h"
@ -46,6 +47,9 @@ int ocf_io_d2c(struct ocf_request *req)
ocf_engine_update_block_stats(req);
ocf_core_stats_pt_block_update(req->core, req->part_id, req->rw,
req->byte_length);
ocf_core_stats_request_pt_update(req->core, req->part_id, req->rw,
req->info.hit_no, req->core_line_count);

View File

@ -87,6 +87,10 @@ int ocf_read_pt_do(struct ocf_request *req)
/* Update statistics */
ocf_engine_update_block_stats(req);
ocf_core_stats_pt_block_update(req->core, req->part_id, req->rw,
req->byte_length);
ocf_core_stats_request_pt_update(req->core, req->part_id, req->rw,
req->info.hit_no, req->core_line_count);

View File

@ -144,6 +144,10 @@ static int _ocf_write_wi_core_write(struct ocf_request *req)
/* Update statistics */
ocf_engine_update_block_stats(req);
ocf_core_stats_pt_block_update(req->core, req->part_id, req->rw,
req->byte_length);
ocf_core_stats_request_pt_update(req->core, req->part_id, req->rw,
req->info.hit_no, req->core_line_count);

View File

@ -50,6 +50,7 @@ static void ocf_stats_part_init(struct ocf_counters_part *stats)
ocf_stats_block_init(&stats->blocks);
ocf_stats_block_init(&stats->core_blocks);
ocf_stats_block_init(&stats->cache_blocks);
ocf_stats_block_init(&stats->pass_through_blocks);
}
static void ocf_stats_error_init(struct ocf_counters_error *stats)
@ -100,6 +101,15 @@ void ocf_core_stats_core_block_update(ocf_core_t core, ocf_part_id_t part_id,
_ocf_stats_block_update(counters, dir, bytes);
}
void ocf_core_stats_pt_block_update(ocf_core_t core, ocf_part_id_t part_id,
int dir, uint64_t bytes)
{
struct ocf_counters_block *counters =
&core->counters->part_counters[part_id].pass_through_blocks;
_ocf_stats_block_update(counters, dir, bytes);
}
void ocf_core_stats_request_update(ocf_core_t core, ocf_part_id_t part_id,
uint8_t dir, uint64_t hit_no, uint64_t core_line_count)
{
@ -313,6 +323,7 @@ int ocf_core_io_class_get_stats(ocf_core_t core, ocf_part_id_t part_id,
copy_block_stats(&stats->blocks, &part_stat->blocks);
copy_block_stats(&stats->cache_blocks, &part_stat->cache_blocks);
copy_block_stats(&stats->core_blocks, &part_stat->core_blocks);
copy_block_stats(&stats->pass_through_blocks, &part_stat->pass_through_blocks);
return 0;
}
@ -358,6 +369,7 @@ int ocf_core_get_stats(ocf_core_t core, struct ocf_stats_core *stats)
accum_block_stats(&stats->core, &curr->blocks);
accum_block_stats(&stats->core_volume, &curr->core_blocks);
accum_block_stats(&stats->cache_volume, &curr->cache_blocks);
accum_block_stats(&stats->pass_through_blocks, &curr->pass_through_blocks);
stats->cache_occupancy += env_atomic_read(&core->runtime_meta->
part_counters[i].cached_clines);

View File

@ -1,5 +1,6 @@
/*
* Copyright(c) 2012-2022 Intel Corporation
* Copyright(c) 2024 Huawei Technologies
* SPDX-License-Identifier: BSD-3-Clause
*/
@ -105,6 +106,14 @@ static void _fill_blocks(struct ocf_stats_blocks *blocks,
_set(&blocks->volume_rd, rd, total);
_set(&blocks->volume_wr, wr, total);
_set(&blocks->volume_total, total, total);
/* Pass Through */
rd = _bytes4k(s->pass_through_blocks.read);
wr = _bytes4k(s->pass_through_blocks.write);
total = rd + wr;
_set(&blocks->pass_through_rd, rd, total);
_set(&blocks->pass_through_wr, wr, total);
_set(&blocks->pass_through_total, total, total);
}
static void _fill_blocks_part(struct ocf_stats_blocks *blocks,
@ -135,6 +144,14 @@ static void _fill_blocks_part(struct ocf_stats_blocks *blocks,
_set(&blocks->volume_rd, rd, total);
_set(&blocks->volume_wr, wr, total);
_set(&blocks->volume_total, total, total);
/* Pass Through */
rd = _bytes4k(s->pass_through_blocks.read);
wr = _bytes4k(s->pass_through_blocks.write);
total = rd + wr;
_set(&blocks->pass_through_rd, rd, total);
_set(&blocks->pass_through_wr, wr, total);
_set(&blocks->pass_through_total, total, total);
}
static void _fill_errors(struct ocf_stats_errors *errors,
@ -209,6 +226,7 @@ static int _accumulate_io_class_stats(ocf_core_t core, void *cntx)
_accumulate_block(&total->cache_blocks, &stats.cache_blocks);
_accumulate_block(&total->core_blocks, &stats.core_blocks);
_accumulate_block(&total->blocks, &stats.blocks);
_accumulate_block(&total->pass_through_blocks, &stats.pass_through_blocks);
_accumulate_reqs(&total->read_reqs, &stats.read_reqs);
_accumulate_reqs(&total->write_reqs, &stats.write_reqs);
@ -395,6 +413,7 @@ static int _accumulate_stats(ocf_core_t core, void *cntx)
_accumulate_block(&total->cache_volume, &stats.cache_volume);
_accumulate_block(&total->core_volume, &stats.core_volume);
_accumulate_block(&total->core, &stats.core);
_accumulate_block(&total->pass_through_blocks, &stats.pass_through_blocks);
_accumulate_reqs(&total->read_reqs, &stats.read_reqs);
_accumulate_reqs(&total->write_reqs, &stats.write_reqs);

View File

@ -1,5 +1,6 @@
/*
* Copyright(c) 2012-2021 Intel Corporation
* Copyright(c) 2024 Huawei Technologies
* SPDX-License-Identifier: BSD-3-Clause
*/
@ -92,6 +93,9 @@ struct ocf_stats_io_class {
/** Block requests for core volume statistics */
struct ocf_stats_block core_blocks;
/** Pass Through block requests statistics */
struct ocf_stats_block pass_through_blocks;
};
#define IO_PACKET_NO 12
@ -139,6 +143,9 @@ struct ocf_stats_core {
/** Block requests submitted by user to this core */
struct ocf_stats_block core;
/** Pass Through block requests statistics */
struct ocf_stats_block pass_through_blocks;
/** Cache volume error statistics */
struct ocf_stats_error cache_errors;
@ -160,6 +167,8 @@ struct ocf_counters_part {
struct ocf_counters_block core_blocks;
struct ocf_counters_block cache_blocks;
struct ocf_counters_block pass_through_blocks;
};
#ifdef OCF_DEBUG_STATS
@ -188,6 +197,8 @@ void ocf_core_stats_cache_block_update(ocf_core_t core, ocf_part_id_t part_id,
int dir, uint64_t bytes);
void ocf_core_stats_vol_block_update(ocf_core_t core, ocf_part_id_t part_id,
int dir, uint64_t bytes);
void ocf_core_stats_pt_block_update(ocf_core_t core, ocf_part_id_t part_id,
int dir, uint64_t bytes);
void ocf_core_stats_request_update(ocf_core_t core, ocf_part_id_t part_id,
uint8_t dir, uint64_t hit_no, uint64_t core_line_count);

View File

@ -1,5 +1,6 @@
#
# Copyright(c) 2019-2021 Intel Corporation
# Copyright(c) 2024 Huawei Technologies
# SPDX-License-Identifier: BSD-3-Clause
#
@ -73,6 +74,9 @@ class BlocksStats(Structure):
("volume_rd", _Stat),
("volume_wr", _Stat),
("volume_total", _Stat),
("pt_rd", _Stat),
("pt_wr", _Stat),
("pt_total", _Stat),
]