Add extra logging for image decompression speed
Sample output:
I zygote : Decompressing image took 3.173ms (678MB/s)
Test: Phone boot with -verbose:image
Bug: 34927277
Change-Id: If0689594bca52d5b98d32d10adfe64f6d2402020
diff --git a/runtime/gc/space/image_space.cc b/runtime/gc/space/image_space.cc
index ffbca52..c0aa668 100644
--- a/runtime/gc/space/image_space.cc
+++ b/runtime/gc/space/image_space.cc
@@ -802,7 +802,11 @@
reinterpret_cast<char*>(map->Begin()) + decompress_offset,
stored_size,
map->Size() - decompress_offset);
- VLOG(image) << "Decompressing image took " << PrettyDuration(NanoTime() - start);
+ const uint64_t time = NanoTime() - start;
+ // Add one 1 ns to prevent possible divide by 0.
+ VLOG(image) << "Decompressing image took " << PrettyDuration(time) << " ("
+ << PrettySize(static_cast<uint64_t>(map->Size()) * MsToNs(1000) / (time + 1))
+ << "/s)";
if (decompressed_size + sizeof(ImageHeader) != image_header.GetImageSize()) {
*error_msg = StringPrintf(
"Decompressed size does not match expected image size %zu vs %zu",