Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1f9d5406 authored by Tom Cherry's avatar Tom Cherry
Browse files

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
parent ff9b1db6
Loading
Loading
Loading
Loading
+12 −2
Original line number Diff line number Diff line
@@ -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
    {
        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
    {
        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);