From: Yingxin Cheng Date: Fri, 24 May 2024 06:54:09 +0000 (+0800) Subject: crimson/os/seastore/../record_submitter: account transaction related stats X-Git-Tag: v19.1.1~213^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=5adb08ffc70aff76487a412b644e0cb991d8b82e;p=ceph.git crimson/os/seastore/../record_submitter: account transaction related stats Signed-off-by: Yingxin Cheng (cherry picked from commit b68a0aec64ba4dccc6b4ff4533f4d77bbb523ec4) --- diff --git a/src/crimson/os/seastore/journal/record_submitter.cc b/src/crimson/os/seastore/journal/record_submitter.cc index 7fe64d90b387..c0cbef2cb570 100644 --- a/src/crimson/os/seastore/journal/record_submitter.cc +++ b/src/crimson/os/seastore/journal/record_submitter.cc @@ -482,6 +482,15 @@ void RecordSubmitter::account_submission( stats.record_group_metadata_bytes += rg.size.get_raw_mdlength(); stats.record_group_data_bytes += rg.size.dlength; stats.record_batch_stats.increment(rg.get_size()); + + for (const record_t& r : rg.records) { + auto src = r.type; + assert(is_modify_transaction(src)); + auto& trans_stats = get_by_src(stats.stats_by_src, src); + ++(trans_stats.num_records); + trans_stats.metadata_bytes += r.size.get_raw_mdlength(); + trans_stats.data_bytes += r.size.dlength; + } } void RecordSubmitter::finish_submit_batch( diff --git a/src/crimson/os/seastore/seastore_types.h b/src/crimson/os/seastore/seastore_types.h index 4e6f3a01a210..cd55e425de57 100644 --- a/src/crimson/os/seastore/seastore_types.h +++ b/src/crimson/os/seastore/seastore_types.h @@ -1888,6 +1888,11 @@ constexpr bool is_trim_transaction(transaction_type_t type) { type == transaction_type_t::TRIM_ALLOC); } +constexpr bool is_modify_transaction(transaction_type_t type) { + return (type == transaction_type_t::MUTATE || + is_background_transaction(type)); +} + struct record_size_t { extent_len_t plain_mdlength = 0; // mdlength without the record header extent_len_t dlength = 0; @@ -2240,12 +2245,19 @@ struct grouped_io_stats { } }; +struct trans_writer_stats_t { + uint64_t num_records = 0; + uint64_t metadata_bytes = 0; + uint64_t data_bytes = 0; +}; + struct writer_stats_t { grouped_io_stats record_batch_stats; grouped_io_stats io_depth_stats; uint64_t record_group_padding_bytes = 0; uint64_t record_group_metadata_bytes = 0; uint64_t record_group_data_bytes = 0; + counter_by_src_t stats_by_src; }; }