From 35f0b4bc4e74f1cc545b85b37e748d62700d952d Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Thu, 14 May 2020 15:46:57 -0500 Subject: [PATCH] ceph-dedup-tool: show object count explosion too Also show dedup ratio as dedup_size/original_size (1.0 = no dedup, .9 = 10%, etc.) Signed-off-by: Sage Weil --- src/tools/ceph_dedup_tool.cc | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/tools/ceph_dedup_tool.cc b/src/tools/ceph_dedup_tool.cc index 42992efcc45..c509b3062ae 100644 --- a/src/tools/ceph_dedup_tool.cc +++ b/src/tools/ceph_dedup_tool.cc @@ -58,6 +58,7 @@ struct EstimateResult { // < key, > map< string, pair > chunk_statistics; uint64_t total_bytes = 0; + std::atomic total_objects = {0}; EstimateResult(std::string alg, int chunk_size) : cdc(CDC::create(alg, chunk_size)), @@ -101,10 +102,12 @@ struct EstimateResult { for (auto& j : chunk_statistics) { dedup_bytes += j.second.second; } - double dedup_ratio = 1.0 - ((double)dedup_bytes / (double)total_bytes); - f->dump_unsigned("dedup_bytes", dedup_bytes); + //f->dump_unsigned("dedup_bytes", dedup_bytes); //f->dump_unsigned("original_bytes", total_bytes); - f->dump_float("dedup_ratio", dedup_ratio); + f->dump_float("dedup_bytes_ratio", + (double)dedup_bytes / (double)total_bytes); + f->dump_float("dedup_objects_ratio", + (double)dedup_objects / (double)total_objects); uint64_t avg = total_bytes / dedup_objects; uint64_t sqsum = 0; @@ -373,6 +376,7 @@ void EstimateDedupRatio::estimate_dedup_ratio() cout << " " << oid << " " << p.first << "~" << p.second << std::endl; } } + ++i.second.total_objects; } } } -- 2.39.5