Android MTK 平台开关机、重启时间优化(二)

一、在工程模式开启MTKLogger, 开机后取日志bootprof 
adb pull /storage/emulated/0/mtklog/mobilelog/APLog_2018_0309_100752/bootprof d:/mtk

二、开机日志分析
2.1 Preloader&lk time
  Preload和lk启动时间如下:
----------------------------------------
0        BOOT PROF (unit:msec)
----------------------------------------
      1288        : preloader
      3364        : lk
----------------------------------------
        46.056922 : ON
       105.511923 :    1-swapper/0       : initcall: of_init    23.163308ms
       135.718000 :    1-swapper/0       : initcall: init_mtk_governor    25.470230ms
       204.063692 :    1-swapper/0       : initcall: arm64_device_init    54.840154ms
       235.911077 :    1-swapper/0       : initcall: pm_sysrq_init    20.581462ms
       313.262308 :    1-swapper/0       : initcall: event_trace_init    35.495538ms
       337.730308 :    1-swapper/0       : probe: probe=platform_drv_probe drv=mt-pmic(ffffffc001131aa8)    18.878000ms
       338.935231 :    1-swapper/0       : initcall: pmic_mt_init    20.627385ms
       437.297846 :    1-swapper/0       : initcall: populate_rootfs    94.791538ms
       533.302462 :    1-swapper/0       : probe: probe=mtkfb_probe drv=mtkfb(ffffffc00114bea8)    22.376538ms
       533.789000 :    1-swapper/0       : initcall: mtkfb_init    23.892077ms
       686.978232 :    1-swapper/0       : probe: probe=spi_drv_probe drv=sunwave-fp(ffffffc001185e48)    64.082231ms
       687.043616 :    1-swapper/0       : initcall: sf_ctl_driver_init    64.994923ms
       746.692155 :    1-swapper/0       : probe: probe=i2c_device_probe drv=ext_speaker_amp(ffffffc00116cbd8)    56.196307ms
       806.679309 :    1-swapper/0       : probe: probe=i2c_device_probe drv=ext_speaker_amp(ffffffc00116cbd8)    59.757230ms
       806.757078 :    1-swapper/0       : probe: probe=platform_drv_probe drv=mt-i2c(ffffffc001186a80)   118.860154ms
       825.896770 :    1-swapper/0       : initcall: mt_i2c_init   138.828692ms
       914.574309 :    1-swapper/0       : probe: probe=platform_drv_probe drv=mt-eem(ffffffc001111b40)    21.778538ms
       916.732232 :    1-swapper/0       : initcall: eem_init    24.701384ms
      1096.474463 :    1-swapper/0       : probe: probe=i2c_device_probe drv=ICM206XX_ACCEL(ffffffc001129888)   162.865462ms
      1096.762156 :    1-swapper/0       : initcall: acc_init   163.479385ms
      1158.710617 :    1-swapper/0       : probe: probe=i2c_device_probe drv=ICM206XX_GYRO(ffffffc00112a568)    61.651154ms
      1158.938925 :    1-swapper/0       : initcall: gyro_init    62.161461ms
      1716.213696 :    1-swapper/0       : initcall: step_c_init   557.250309ms
   
   2.2 Kernel Init
    Kernel初始化时间 如下  
     1760.835696 :    1-swapper/0       : Kernel_init_done
     1958.778235 :  133-kworker/u20:2   : probe: probe=i2c_device_probe drv=NVT-ts(ffffffc00117f630)   219.942077ms
  1967.041619 :  133-kworker/u20:2   : probe: probe=platform_drv_probe drv=mtk-tpd(ffffffc00117e440)   228.713462ms
      2143.452389 :    1-init            : INIT:early-init
      2459.731928 :    1-init            : INIT:late-init
  
   2.3 Mount partition
    分区挂载时间如下:
    
   
     2459.775082 :    1-init            : INIT:Mount_START
     13156.166492 :    1-init            : INIT:Mount_END
     13159.090954 :    1-init            : MOBICORE: Starting mcDriverDaemon
     13159.979415 :    1-init            : MOBICORE: export MC_AUTH_TOKEN_PATH /efs
     13452.475185 :    1-init            : INIT:post-fs
     14199.575572 :  336-vold            : vold:init_user0:START
     14207.002648 :  336-vold            : vold:init_user0:END
     14293.808110 :    1-init            : INIT:post-fs-data
     14326.311341 :    1-init            : post-fs-data: on modem start
     14925.697266 :    1-init            : INIT:boot
     14965.581266 :    1-init            : MOBICORE: create /data/misc/mcRegistry ++ (unencrypted)
     14968.924496 :    1-init            : MOBICORE: create /data/misc/mcRegistry -- (unencrypted)
     14971.746112 :    1-init            : MOBICORE: create /data/misc/mcRegistry ++ (unencrypted)
     14974.070189 :    1-init            : MOBICORE: create /data/misc/mcRegistry -- (unencrypted)


     17201.363271 :  407-main            : Zygote:Preload Start
     17284.645810 :  406-main            : Zygote:Preload Start
   
    2.4     Android Boot
   2. 4.1  Pre-load classes
            预加载类所消耗的时间
     18085.504350 :  367-surfaceflinger  : BOOT_Animation:START
     18399.795505 :  406-main            : Zygote:Preload 4158 classes in 1046ms
     18410.484735 :  407-main            : Zygote:Preload 4158 classes in 1089ms
     18613.683890 :  407-main            : Zygote:Preload 162 obtain resources in 202ms
     18613.828044 :  406-main            : Zygote:Preload 162 obtain resources in 213ms
     18763.778198 :  406-main            : Zygote:Preload 285 resources in 144ms
     18773.443352 :  407-main            : Zygote:Preload 285 resources in 151ms
     18887.130506 :  406-main            : Zygote:Preload End
     18967.149429 :  407-main            : Zygote:Preload End


2.5 Package scanning
     包扫描时间


     19037.841045 :  977-system_server   : Android:SysServerInit_START
     19504.301430 :  977-system_server   : Android:PackageManagerService_Start
     19955.239201 :  977-system_server   : Android:PMS_scan_START
     19997.760047 :  977-system_server   : Android:PMS_scan_data:/system/framework
     20035.112662 :  977-system_server   : Android:PMS_scan_data:/vendor/framework
     20041.542816 :  977-system_server   : Android:PMS_scan_data:/system/priv-app
     20499.426125 :  977-system_server   : Android:PMS_scan_data:/system/app
     20678.174202 :  977-system_server   : Android:PMS_scan_data:/vendor/priv-app
     20701.053356 :  977-system_server   : Android:PMS_scan_data:/system/vendor/app
     20745.336510 :  977-system_server   : Android:PMS_scan_data:/vendor/plugin
     20762.965972 :  977-system_server   : Android:PMS_scan_data:/system/presetapp
     21248.402973 :  977-system_server   : Android:PMS_scan_data:/data/app
     22939.954362 :  977-system_server   : Android:PMS_scan_END


     2.6App initializations
     AP初始化时间

     23001.924746 :  977-system_server   : PMS:reconcileAppsDataLI
     24021.181364 :  977-system_server   : Android:PMS_READY
     31995.755306 :  977-system_server   : AMS:systemReady
     32026.348999 :  977-system_server   : AMS:AMS_READY
     32138.240922 :  977-system_server   : AP_Init:[service]:[com.android.inputmethod.latin]:[com.android.inputmethod.latin/.LatinIME]:pid:1373
     32164.388537 :  977-system_server   : AP_Init:[added application]:[com.android.phone]:[com.android.phone]:pid:1389:(PersistAP)
     32256.007922 :  977-system_server   : AP_Init:[]:[WebViewLoader-armeabi-v7a]:pid:1419
     32271.729076 :  977-system_server   : AP_Init:[]:[WebViewLoader-arm64-v8a]:pid:1431
     32286.962922 :  977-system_server   : AP_Init:[service]:[com.android.systemui]:[com.android.systemui/.SystemUIService]:pid:1456:(PersistAP)
     32488.827538 :  977-system_server   : SystemServer:NetworkManagementService systemReady
     32612.675154 :  977-system_server   : SystemServer:NetworkStatsService systemReady
     33034.495924 :  977-system_server   : SystemServer:NetworkPolicyManagerService systemReady
     33104.174770 :  977-system_server   : SystemServer:ConnectivityService systemReady
     33200.794386 :  977-system_server   : SystemServer:PhaseThirdPartyAppsCanStart
     33218.315694 :  977-system_server   : AP_Init:[added application]:[com.mediatek.ims]:[com.mediatek.ims]:pid:1691:(PersistAP)
     33241.393002 :  977-system_server   : AP_Init:[added application]:[com.mediatek.wfo.impl]:[com.mediatek.wfo.impl]:pid:1706:(PersistAP)
     33279.524617 :  977-system_server   : Android:SysServerInit_END
     33306.355771 :  993-Binder:977_2    : AP_Init:[activity]:[com.android.settings]:[com.android.settings/.FallbackHome]:pid:1726
     33622.446233 :  977-system_server   : AP_Init:[service]:[com.android.dialer]:[com.android.dialer/com.android.incallui.InCallServiceImpl]:pid:1810
     33733.981387 : 1719-Binder:977_5    : AP_Init:[broadcast]:[com.mediatek.deviceregister]:[com.mediatek.deviceregister/.RegisterReceiver]:pid:1857
     33759.406541 : 1030-android.display : AP_Launch: com.android.settings/.FallbackHome 473ms
     33764.264849 : 1012-ActivityManager : AMS:ENABLE_SCREEN
     33912.655234 : 1012-ActivityManager : AP_Init:[broadcast]:[com.mediatek.selfregister]:[com.mediatek.selfregister/.RegisterReceiver]:pid:1896
     34563.454466 :  993-Binder:977_2    : AP_Init:[broadcast]:[com.mediatek.deviceregister]:[com.mediatek.deviceregister/.RegisterReceiver]:pid:1970
     34738.516544 :  993-Binder:977_2    : AP_Init:[broadcast]:[com.mediatek.deviceregister]:[com.mediatek.deviceregister/.RegisterReceiver]:pid:1992
     34860.379313 : 1012-ActivityManager : AP_Init:[broadcast]:[com.mediatek.deviceregister]:[com.mediatek.deviceregister/.RegisterReceiver]:pid:2017
     34979.781083 : 1012-ActivityManager : AP_Init:[broadcast]:[com.mediatek.deviceregister]:[com.mediatek.deviceregister/.RegisterReceiver]:pid:2030
     35563.128238 : 1719-Binder:977_5    : AP_Init:[broadcast]:[com.mediatek.deviceregister]:[com.mediatek.deviceregister/.RegisterReceiver]:pid:2087
     35691.079469 : 1012-ActivityManager : AP_Init:[broadcast]:[com.mediatek.deviceregister]:[com.mediatek.deviceregister/.RegisterReceiver]:pid:2105
     35820.522315 : 1012-ActivityManager : AP_Init:[broadcast]:[com.mediatek.deviceregister]:[com.mediatek.deviceregister/.RegisterReceiver]:pid:2120
     36557.641856 : 1720-Binder:977_6    : AP_Init:[broadcast]:[com.mediatek.deviceregister]:[com.mediatek.deviceregister/.RegisterReceiver]:pid:2153
     36922.936164 : 1483-Binder:977_4    : AP_Init:[broadcast]:[com.mediatek.deviceregister]:[com.mediatek.deviceregister/.RegisterReceiver]:pid:2171
     37377.391319 : 1720-Binder:977_6    : AP_Init:[broadcast]:[com.mediatek.deviceregister]:[com.mediatek.deviceregister/.RegisterReceiver]:pid:2190
     37625.694089 : 1005-Binder:977_3    : AP_Init:[broadcast]:[com.mediatek.deviceregister]:[com.mediatek.deviceregister/.RegisterReceiver]:pid:2208
     39322.800862 :  992-Binder:977_1    : AP_Init:[broadcast]:[com.mediatek.deviceregister]:[com.mediatek.deviceregister/.RegisterReceiver]:pid:2237
     39834.590556 : 2167-Binder:367_5    : BOOT_Animation:END
     39834.612248 : OFF
----------------------------------------
================ END of FILE ===============

三、开机时间优化方法

3.1 开机过程中CPU调频调核(kernel,系统),开启多核和调高频率,关注功耗,优化。

3.2 开机过程PMS多线程进行包扫描

3.3 PMS扫描过程中直接根据应用的Native层库目录名称确定应用的ABI,加速扫描.

3.4添加资源预加载优化

3.5关闭系统层和Kernel层日志

3.6 分区挂载是否重复

3.7开机日志分解定位是否有异常耗时点,针对性进行优化
--------------------- 
作者:zhangbijun1230 
来源:CSDN 
原文:https://blog.csdn.net/zhangbijun1230/article/details/79494559 
版权声明:本文为博主原创文章,转载请附上博文链接!

你可能感兴趣的:(性能)