2015年7月16日 星期四

Boot time

BootEvent:

cat /proc/bootprof    /** M: Mtprof tool @{ */

LINUX/android/system/core/rootdir/init.rc
INIT: on init start

LINUX/android/device/mediatek/mt6795/init.mt6795.rc
INIT:Mount_START
INIT:Mount_END

LINUX/android/frameworks/base/core/java/com/android/internal/os/ZygoteInit.java
Zygote:Preload

frameworks/native/services/surfaceflinger/mediatek/SurfaceFlinger.cpp
frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
BOOT_Animation:START
BOOT_Animation:END

./services/java/com/android/server/SystemServer.java
Android:SysServerInit_START

frameworks/base/services/core/java/com/android/server/pm/PackageManagerService.java
Android:PackageManagerService_Start

frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
AP_Init:[]

Log:

Boot animation time:

frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
 316 void SurfaceFlinger::bootFinished()
 317 {
 318     const nsecs_t now = systemTime();
 319     const nsecs_t duration = now - mBootTime;
 320     ALOGI("Boot is finished (%ld ms)", long(ns2ms(duration)) );
 321     mBootFinished = true;
 322
 323     // wait patiently for the window manager death
 324     const String16 name("window");
 325     sp<IBinder> window(defaultServiceManager()->getService(name));
 326     if (window != 0) {
 327         window->linkToDeath(static_cast<IBinder::DeathRecipient*>(this));
 328     }
 329
 330     // stop boot animation
 331     // formerly we would just kill the process, but we now ask it to exit so it
 332     // can choose where to stop the animation.
 333     property_set("service.bootanim.exit", "1");
 334
 335 #ifdef MTK_AOSP_ENHANCEMENT
 336     // boot time profiling
 337     ALOG(LOG_INFO,"boot","BOOTPROF:BootAnimation:End:%ld", long(ns2ms(systemTime())));
 338     bootProf(0);
 339     SFWatchDog::getInstance()->setThreshold(500);
 340 #endif
 341 }

Scan package time:

frameworks/base/services/core/java/com/android/server/pm/PackageManagerService.java
            /** M: Add PMS scan package time log @{ */
            startScanTime = SystemClock.uptimeMillis();
            Slog.d(TAG, "scan package: " + file.toString() + " , start at: " + startScanTime + "ms.");
            /** M: Add PMS scan package time log @{ */
            endScanTime = SystemClock.uptimeMillis();
            Slog.d(TAG, "scan package: " + file.toString() + " , end at: " + endScanTime + "ms. elapsed time = " + (endScanTime - startScanTime) + "ms.");

            Slog.i(TAG, "Time to scan packages: "
                    + ((SystemClock.uptimeMillis()-startTime)/1000f)
                    + " seconds");

AP initialization time:

frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
            StringBuilder buf = mStringBuilder;
            buf.setLength(0);
            buf.append("Start proc ");
            buf.append(app.processName);
            if (!isActivityProcess) {
                buf.append(" [");
                buf.append(entryPoint);
                buf.append("]");
            }
            buf.append(" for ");
            buf.append(hostingType);
            if (hostingNameStr != null) {
                buf.append(" ");
                buf.append(hostingNameStr);
            }
            buf.append(": pid=");
            buf.append(startResult.pid);
            buf.append(" uid=");
            buf.append(uid);
            buf.append(" gids={");
            if (gids != null) {
                for (int gi=0; gi<gids.length; gi++) {
                    if (gi != 0) buf.append(", ");
                    buf.append(gids[gi]);
                }
            }
            buf.append("}");
            if (requiredAbi != null) {
                buf.append(" abi=");
                buf.append(requiredAbi);
            }
            Slog.i(TAG, buf.toString());

沒有留言: