Android system start-up time

Source: Internet
Author: User

The start-up time of the Android system mentioned here is not simply to use the stopwatch and the naked eye to statistics, but through the analysis of the system output log information to statistics, so that it appears more professional and accurate.


Start by understanding 2 concepts:


(1) Android is a Linux kernel-based system, so the Android boot process is divided into two stages, the first phase is the start of the Linux kernel, the second stage is the launch of the Android framework (including core services and programs).


(2) The log system of Android is independent of the Linux kernel's log system. The Linux kernel prints the log information via PRINTK, which is written to the/dev/kmsg file and can be viewed by the shell terminal via the DMESG command. The Android framework prints log information via the logger driver, which is not merged into the KMESG file, but is stored separately in the/dev/log directory, which can be viewed by the Logcat command in the shell terminal.


Let's find out how to count the system startup time separately from the two log messages.


1. DMESG Information Statistics System start-up time


First, we crawl the log information of the Linux kernel via the DMESG command (some systems may need to perform ADB root first):


$ adb shell DMESG > Dmesg.txt


The Linux kernel starts up and generally has the following standard output information:


[3.838682] Freeing Initrd memory:1844k (ffffffc003600000-ffffffc0037cd000)


Therefore, as long as we find in the Dmesg.txt file "Freeing initrd memory" this line, from the above log can be seen, the Linux kernel started using only 3.838682s.


So, how to find the Android system boot complete logo?


Many Android devices will print the following information in the kernel log after the system is booted:


<6>[29.913726] init:processing action 0x96bb8 (property:sys.boot_completed=1)


Therefore, find "boot_completed" This line also got the whole system start time, from this line can be seen, the whole system started using 29.913726s.


Of course, not all Android devices will print this log, so we typically use the method described below to specifically count the startup time of the Android system,


2. Through the Logcat statistical system start-up time


At the beginning of the article we have introduced, Android log system is independent of the Linux kernel log system, through the terminal input adb shell into the Android system, CD to the/dev/log directory, you will find that there are four files, namely: events, Main,radio,system.


The Android system divides the log into four categories, and different categories record different log messages:


Main-Primary log information, most of the application-level log information is here

Events-Log information related to system events

Radio-Wireless/phone-related log information

System-Low Level debug log information


By default, the main information is crawled through logcat, and if you want to crawl the log information for a specified category, add the-b parameter after the LOGCAT command, for example:

ADB logcat-d-v time-b "main" > Main.txt adb logcat-d-v time-b "events" > events.txt adb logcat-d-v time -B "System" > System.txt adb logcat-d-v time-b "Radio" > Radio.txt

So how do you count the startup time of your Android system?


We can focus on the log information for the events category via the following command:


$ adb logcat-d-B Events | grep "Boot"


, this is the log message I crawled on the msm8953 Development Board of Qualcomm:


650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/6E/55/wKioL1V5fk2zyWfUAAHv186gKeI487.jpg "title=" 1.png " alt= "Wkiol1v5fk2zywfuaahv186gkei487.jpg"/>


"Boot_progress_start" represents the Android screen lit, starting to show the start animation, that is, 15.492s starts flashing Android words.


"Boot_progress_enable_screen" represents the end of the entire system start-up, that is, 29.986s, with this total time minus the startup time of the Linux kernel to get the Android OS part of the time.



This article is from the "canvas shoes can walk the cat step" blog, please be sure to keep this source http://9409270.blog.51cto.com/9399270/1971774

Android system start-up time

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.