summaryrefslogtreecommitdiffstats
path: root/init/reboot.cpp
diff options
context:
space:
mode:
authorTom Cherry <tomcherry@google.com>2018-03-15 10:22:40 -0700
committerTom Cherry <tomcherry@google.com>2018-03-15 10:24:00 -0700
commit1f9d5406b3e4e86724248b71a3bd68a1440169e2 (patch)
tree6de805ae1fbc90af4bfdeff065ea11cc093da19b /init/reboot.cpp
parentff9b1db67c930a3e04ed29714d8b872e92e27b85 (diff)
downloadsystem_core-1f9d5406b3e4e86724248b71a3bd68a1440169e2.tar.gz
system_core-1f9d5406b3e4e86724248b71a3bd68a1440169e2.tar.bz2
system_core-1f9d5406b3e4e86724248b71a3bd68a1440169e2.zip
init: add timers around sync() during shutdown
It seems that these sync() calls may take a long time in some occasions, so we add these logs to check. Bug: 74817735 Test: tree hugger Change-Id: Id3635f6c7a6618b20c7caf93b05e50cc50ef99de
Diffstat (limited to 'init/reboot.cpp')
-rw-r--r--init/reboot.cpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/init/reboot.cpp b/init/reboot.cpp
index 03ed55a1b..bb87f1292 100644
--- a/init/reboot.cpp
+++ b/init/reboot.cpp
@@ -429,10 +429,20 @@ void RebootThread(unsigned int cmd, std::chrono::milliseconds shutdown_timeout,
if (kill_after_apps.count(s->name())) s->Stop();
}
// 4. sync, try umount, and optionally run fsck for user shutdown
- sync();
+ {
+ Timer sync_timer;
+ LOG(INFO) << "sync() before umount...";
+ sync();
+ LOG(INFO) << "sync() before umount took" << sync_timer;
+ }
UmountStat stat = TryUmountAndFsck(runFsck, shutdown_timeout - t.duration());
// Follow what linux shutdown is doing: one more sync with little bit delay
- sync();
+ {
+ Timer sync_timer;
+ LOG(INFO) << "sync() after umount...";
+ sync();
+ LOG(INFO) << "sync() after umount took" << sync_timer;
+ }
if (cmd != ANDROID_RB_THERMOFF) std::this_thread::sleep_for(100ms);
LogShutdownTime(stat, &t);