diff options
author | Sen Jiang <senj@google.com> | 2018-10-25 15:15:38 -0700 |
---|---|---|
committer | Treehugger Robot <treehugger-gerrit@google.com> | 2018-10-26 03:25:01 +0000 |
commit | a91195d0da8751af5d434d6465ff33f2712aca2c (patch) | |
tree | 02fde1ed911a64e2dfbb265513fc782f5c19030e | |
parent | e4ba45f6b2c7ac073ec7a91c34387f8a85d8fc39 (diff) |
Prefix operation name with partition name.
In the final breakdown we can now easily spot which partition the
largest operations come from.
Also changed LOG(INFO) to printf to get rid of the timestamp in the
report making it difficult to compare.
Bug: None
Test: check log of generating payload
Change-Id: Iec26e864ffc1cd507c9e78733f5cda1f53886db1
-rw-r--r-- | payload_generator/payload_file.cc | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/payload_generator/payload_file.cc b/payload_generator/payload_file.cc index 0ffd3e2e..13cf4895 100644 --- a/payload_generator/payload_file.cc +++ b/payload_generator/payload_file.cc @@ -345,8 +345,10 @@ void PayloadFile::ReportPayloadUsage(uint64_t metadata_size) const { off_t total_size = 0; for (const auto& part : part_vec_) { + string part_prefix = "<" + part.name + ">:"; for (const AnnotatedOperation& aop : part.aops) { - DeltaObject delta(aop.name, aop.op.type(), aop.op.data_length()); + DeltaObject delta( + part_prefix + aop.name, aop.op.type(), aop.op.data_length()); object_counts[delta]++; total_size += aop.op.data_length(); } @@ -355,25 +357,22 @@ void PayloadFile::ReportPayloadUsage(uint64_t metadata_size) const { object_counts[DeltaObject("<manifest-metadata>", -1, metadata_size)] = 1; total_size += metadata_size; - static const char kFormatString[] = "%6.2f%% %10jd %-13s %s %d"; + constexpr char kFormatString[] = "%6.2f%% %10jd %-13s %s %d\n"; for (const auto& object_count : object_counts) { const DeltaObject& object = object_count.first; - LOG(INFO) << base::StringPrintf( + // Use printf() instead of LOG(INFO) because timestamp makes it difficult to + // compare two reports. + printf( kFormatString, object.size * 100.0 / total_size, - static_cast<intmax_t>(object.size), + object.size, (object.type >= 0 ? InstallOperationTypeName( static_cast<InstallOperation_Type>(object.type)) : "-"), object.name.c_str(), object_count.second); } - LOG(INFO) << base::StringPrintf(kFormatString, - 100.0, - static_cast<intmax_t>(total_size), - "", - "<total>", - 1); + printf(kFormatString, 100.0, total_size, "", "<total>", 1); } } // namespace chromeos_update_engine |