summaryrefslogtreecommitdiffstats
path: root/updater/blockimg.cpp
diff options
context:
space:
mode:
authorTianjie Xu <xunchang@google.com>2016-05-18 20:47:31 +0200
committerandroid-build-merger <android-build-merger@google.com>2016-05-18 20:47:31 +0200
commitfb5d7f6172f88a9e26ef554ef56717798f83522d (patch)
treed14f03a57b8325172ca4d38b18cefd199ed43023 /updater/blockimg.cpp
parentMerge "Keep ADF device alive for the lifetime of the minui backend" am: 14352497f0 am: 32c2e78726 (diff)
parentAdd time and I/O info to last_install (diff)
downloadandroid_bootable_recovery-fb5d7f6172f88a9e26ef554ef56717798f83522d.tar
android_bootable_recovery-fb5d7f6172f88a9e26ef554ef56717798f83522d.tar.gz
android_bootable_recovery-fb5d7f6172f88a9e26ef554ef56717798f83522d.tar.bz2
android_bootable_recovery-fb5d7f6172f88a9e26ef554ef56717798f83522d.tar.lz
android_bootable_recovery-fb5d7f6172f88a9e26ef554ef56717798f83522d.tar.xz
android_bootable_recovery-fb5d7f6172f88a9e26ef554ef56717798f83522d.tar.zst
android_bootable_recovery-fb5d7f6172f88a9e26ef554ef56717798f83522d.zip
Diffstat (limited to 'updater/blockimg.cpp')
-rw-r--r--updater/blockimg.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/updater/blockimg.cpp b/updater/blockimg.cpp
index 12a549dba..885a517ec 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<uint8_t> buffer;
@@ -774,6 +775,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);
}
@@ -970,6 +972,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;
@@ -1511,8 +1514,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);