Make cow converter print estimated size and actual size
Test: th
Change-Id: If9092a23247d0c6bd5f45de4b94d1d61ee7eafb3
diff --git a/aosp/cow_converter.cc b/aosp/cow_converter.cc
index 3d314c4..f4ac5b0 100644
--- a/aosp/cow_converter.cc
+++ b/aosp/cow_converter.cc
@@ -124,11 +124,38 @@
return 5;
}
+ size_t estimated_total_cow_size = 0;
+ size_t actual_total_cow_size = 0;
+
for (const auto& partition : manifest.partitions()) {
+ if (partition.estimate_cow_size() == 0) {
+ continue;
+ }
LOG(INFO) << partition.partition_name();
if (!ProcessPartition(partition, images_dir, manifest.block_size())) {
return 6;
}
+ base::FilePath img_dir{images_dir};
+ const auto output_cow =
+ img_dir.Append(partition.partition_name() + ".cow").value();
+ const auto actual_cow_size =
+ chromeos_update_engine::utils::FileSize(output_cow);
+ LOG(INFO) << partition.partition_name()
+ << ": estimated COW size is: " << partition.estimate_cow_size()
+ << ", actual COW size is: " << actual_cow_size
+ << ", estimated COW size is "
+ << (actual_cow_size - partition.estimate_cow_size()) * 100.0f /
+ actual_cow_size
+ << "% smaller";
+ estimated_total_cow_size += partition.estimate_cow_size();
+ actual_total_cow_size += actual_cow_size;
}
+
+ LOG(INFO) << "Total estimated COW size is: " << estimated_total_cow_size
+ << ", Total actual COW size is: " << actual_total_cow_size
+ << ", estimated COW size is "
+ << (actual_total_cow_size - estimated_total_cow_size) * 100.0f /
+ actual_total_cow_size
+ << "% smaller";
return 0;
}