From dd874b1c87eb04f28db0db2629df0adde568a74c Mon Sep 17 00:00:00 2001 From: Tianjie Xu Date: Fri, 13 May 2016 12:13:15 -0700 Subject: Add time and I/O info to last_install One example of last_install is: /sideload/package.zip 1 time_total: 101 bytes_written_system: 14574000 bytes_stashed_system: 100 bytes_written_vendor: 5107400 bytes_stashed_vendor: 0 Bug: 28658632 Change-Id: I4bf79ea71a609068d38fbce6b41bcb892524aa7a --- updater/blockimg.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'updater/blockimg.cpp') diff --git a/updater/blockimg.cpp b/updater/blockimg.cpp index c20bad904..d67af664a 100644 --- a/updater/blockimg.cpp +++ b/updater/blockimg.cpp @@ -373,6 +373,7 @@ struct CommandParameters { bool isunresumable; int version; size_t written; + size_t stashed; NewThreadInfo nti; pthread_t thread; std::vector buffer; @@ -777,6 +778,7 @@ static int SaveStash(CommandParameters& params, const std::string& base, } fprintf(stderr, "stashing %zu blocks to %s\n", blocks, id.c_str()); + params.stashed += blocks; return WriteStash(base, id, blocks, buffer, false, nullptr); } @@ -973,6 +975,7 @@ static int LoadSrcTgtVersion3(CommandParameters& params, RangeSet& tgt, size_t& return -1; } + params.stashed += src_blocks; // Can be deleted when the write has completed if (!stash_exists) { params.freestash = srchash; @@ -1517,8 +1520,17 @@ static Value* PerformBlockImageUpdate(const char* name, State* state, int /* arg pthread_join(params.thread, nullptr); fprintf(stderr, "wrote %zu blocks; expected %d\n", params.written, total_blocks); + fprintf(stderr, "stashed %zu blocks\n", params.stashed); fprintf(stderr, "max alloc needed was %zu\n", params.buffer.size()); + const char* partition = strrchr(blockdev_filename->data, '/'); + if (partition != nullptr && *(partition+1) != 0) { + fprintf(cmd_pipe, "log bytes_written_%s: %zu\n", partition + 1, + params.written * BLOCKSIZE); + fprintf(cmd_pipe, "log bytes_stashed_%s: %zu\n", partition + 1, + params.stashed * BLOCKSIZE); + fflush(cmd_pipe); + } // Delete stash only after successfully completing the update, as it // may contain blocks needed to complete the update later. DeleteStash(params.stashbase); -- cgit v1.2.3