]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson/os/seastore/../record_submitter: account transaction related stats
authorYingxin Cheng <yingxin.cheng@intel.com>
Fri, 24 May 2024 06:54:09 +0000 (14:54 +0800)
committerMatan Breizman <mbreizma@redhat.com>
Sun, 16 Jun 2024 10:22:27 +0000 (13:22 +0300)
Signed-off-by: Yingxin Cheng <yingxin.cheng@intel.com>
(cherry picked from commit b68a0aec64ba4dccc6b4ff4533f4d77bbb523ec4)

src/crimson/os/seastore/journal/record_submitter.cc
src/crimson/os/seastore/seastore_types.h

index 7fe64d90b387482718479454ccff6b2f06ca2e5d..c0cbef2cb5703e0d725805c4a7d17a0679469c31 100644 (file)
@@ -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(
index 4e6f3a01a21028d01c8249cfc70300b57dba14eb..cd55e425de575709e287cb15fa8151d3bf09f668 100644 (file)
@@ -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<trans_writer_stats_t> stats_by_src;
 };
 
 }