android fs_trim

android fs_trim

Android中的TRIM优化

fstrim调用时机:

1. 系统启动时:

默认最小间隔时间 3天
private void startOtherServices() {
        ......
        traceBeginAndSlog("PerformFstrimIfNeeded");
        try {
            mPackageManagerService.performFstrimIfNeeded();
        } catch (Throwable e) {
            reportWtf("performing fstrim", e);
        }
        traceEnd();
        .....
}

2. 系统启动时设置的定时任务:

每日凌晨3:00
    private void handleSystemReady() {
        initIfReadyAndConnected();
        resetIfReadyAndConnected();

        // Start scheduling nominally-daily fstrim operations
        MountServiceIdler.scheduleIdlePass(mContext);
    }

发表评论

电子邮件地址不会被公开。 必填项已用*标注