SlideShare uma empresa Scribd logo
1 de 59
Baixar para ler offline
Connect your device to application
Android Boot Time
Optimization




Kan-Ru Chen
                    kanru@0xlab.org
                       Sep 09, 2011
Agenda   Motivation
         Boot Time Measurement
         Android Boot Time Analysis
         Reduction Approach
         Hibernation Based Technologies
         We Don't Need Boot-loader
         Demo
         Future Work and Conclusions
Motivation
Boot Time Measurement
Traditional Linux Environment
Printk Times
Linux kernel feature
Built-in since Linux 2.6.11
How to enable?

    Add CONFIG_PRINTK_TIME=y to .config

    Or choose from menuconfig
    Kernel hacking --->
      [*] Show timing information on printks
Printk Times
Output Example
linux$ dmesg
[0.000000] per task-struct memory footprint: 1152 bytes
[0.003692] Calibrating delay loop... 506.27 BogoMIPS (lpj=1978368)
[0.079833] pid_max: default: 32768 minimum: 301
[0.080230] Security Framework initialized
[0.080474] Mount-cache hash table entries: 512
[0.083892] CPU: Testing write buffer coherency: ok

Analysis Tool
linux$ dmesg > timefile
linux$ scripts/show_delta timefile
...
[0.194488 < 0.194488 >] OMAP DMA hardware revision 5.0
[0.259948 < 0.065460 >] bio: create slab <bio-0> at 0
[0.267822 < 0.007874 >] SCSI subsystem initialized
...
initcall_debug
Kernel Parameter
Print the time spent for each initcall
Output Example
calling ipc_init+0x0/0x28 @ 1
msgmni has been set to 42
initcall ipc_init+0x0/0x28 returned 0 after 1872 usecs
Bootchart
Visualize the booting process
Use “bootchartd” to collect CPU and IO utilization
information.
On Ubuntu:
 apt-get install bootchart bootchart-view
Original “bootchartd” is not suitable for embedded
usage.
Bootchart
$ bootchart bootchart.tgz -f png
Strace
Trace system calls during process execution and
output timing information.
$ strace -tt ls
15:11:04.243357 execve("/bin/ls", ["ls"], [/* 51 vars */]) = 0
15:11:04.244252 brk(0)                  = 0x234f000
15:11:04.244458 access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT
15:11:04.244676 mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|
MAP_ANONYMOUS, -1, 0) = 0x7f1444794000
15:11:04.244852 access("/etc/ld.so.preload", R_OK) = -1 ENOENT
15:11:04.245096 open("/etc/ld.so.cache", O_RDONLY) = 3
OProfile
OProfile is a system-wide profiler for Linux systems.
Capable of profiling all running code at low overhead.
Supports wide number of hardwares.
Profiling daemon ported to Android and available in
AOSP.
OProfile
Output Example
$ opreport --exclude-dependent
CPU: PIII, speed 863.195 MHz (estimated)
Counted CPU_CLK_UNHALTED events (clocks processor is not halted)...
450385 75.6634 cc1plus
 60213 10.1156 lyx
 29313 4.9245 XFree86
 11633 1.9543 as
 10204 1.7142 oprofiled
  7289 1.2245 vmlinux
  7066 1.1871 bash
  6417 1.0780 oprofile
  6397 1.0747 vim
...
Perf
New profiling tool based on the performance counter
subsystem of Linux.
Very powerful and easy to use.
Included in Linux source code:
tools/perf/
Perf
Recording:
$ perf record -a -f
^C
[ perf record: Woken up 1 times to write data ]
[ perf record: Captured and wrote 0.288 MB perf.data (~12567 samples)]


Output
$   perf report --sort comm,dso,symbol|head -10
#   Events: 1K cycles
#
#   Overhead       Command            Shared Object         Symbol
#   ........   ...........   ......................   ............
#
      35.47%      firefox    libxul.so                [.]   0xc1b3a7
       3.08%      firefox    libcairo.so.2.11000.2    [.]   0xff88
       2.98%         Xorg    Xorg (deleted)           [.]   0xe201c
       2.51%      firefox    firefox                  [.]   0x2726
       1.49%         Xorg    [kernel.kallsyms]        [k]   find_vma
       0.93%   perf_3.0.0    perf_3.0.0               [.]   hex2u64
Perf
  Timechart
$ perf timechart record
  $ perf timechart
Android Environment
Bootchart
Original “bootchartd” is not suitable on embedded
devices.
Android re-implemented in its “init” program.
Bootchart
To build:
$ cd system/core/init
$ touch init.c
$ mm INIT_BOOTCHART=true
Bootchart
To run:
$ adb shell 'echo 120 > /data/bootchart-start'
Remember the /data directory must be write able
during boot.
Use grab-bootchart.sh to retrieve the data.
Strace
After analyzed the bootchart, can use strace to
analyze individual progarm.
Available in AOSP since Éclair
Strace
Modify init.rc from
service zygote /system/bin/app_process -Xzygote /system/bin 
                             --zygote --start-system-server




To
 service zygote /system/xbin/strace -tt -o/data/boot.strace 
                /system/bin/app_process -Xzygote /system/bin 
                              --zygote --start-system-server
Logcat
Android log utility
Can output timing information
Adjust loglevel to 6 in init.rc

    Displays time spent for each command
Dalvik Method Tracer
Method tracer is built into Dalvik
Use DDMS or using calls inside source to collect data.
// start tracing to "/sdcard/calc.trace"
Debug.startMethodTracing("calc");
// ...
// stop tracing
Debug.stopMethodTracing();
Stopwatch
Not real stopwatch
A utility in Android Framework for measuring C++
code.
Output result to system log
#include <utils/StopWatch.h>
…
{
    StopWatch watch("blah");
    /* your codes here */
}
Q&A
Android Boot Time Analysis
Boot-loader Init
Usually constant time
Avoid init hardware multiple times
Ensure to use maximum CPU frequency
Use faster NAND/MMC reading mechanism
Kernel Init
Mostly usual suspects

    ip_auto_config

    USB init

    Flash driver initialization

Fullow the standard Kernel optimizing guide:
   http://elinux.org/Boot_Time

Avoid loading unneeded kernel module at boot time
Zygote Class Preloading
Android Framework has thousands of Java classes
Preloaded by Zygote and instantiated in its heap
To improve Application startup time and save memory
Controlled by resource: preloaded-classes

    frameworks/base/preloaded-classes
Zygote Class Preloading
Can use the tool in framework to adjust the list:
$ adb logcat > logcat.txt
$ java -p preload.jar Compile logcat.txt logcat.compiled
$ java -p preload.jar PrintCsv logcat.compiled

Google Android Developer Dianne Hackborn said:

    The content of the file is a “black art”

    You can adjust this as much as you like

    But the result maybe suboptimal
PackageManager Package Scannig
Every APK is scanned at boot time
Package management code is inefficient
Uses mmaped files means each access will cause
page fault
ParseZipArchive() scans entire APK for only one
AndroidManifest.xml file
System Services Starting
Last stage of Android boot
Start every base service
Zygote start SystemServer process
Start native service (SurfaceFlinger, AudioFlinger) first
Start each service sequentially
Q&A
Reduction Approach
Boot-loader
Improve U-Boot

    Reading multi-mmc-block

    Cache (I/D) enablement

    Optimize CRC32

    Disable verification
Boot-loader
Qi Boot-loader
                                                        Qi           U-Boot + XLoader
                                                        Boot-oader
                                       Size             ~30K         ~270K+20K

    Only one stage boot-loader         Time to Kernel   <1s          > 5s


    Small footprint ~30K               Usage            Product      Engineering

                                       Code             Simple       Complicated

    Currently support
     −   iMX31
     −   Samsung 24xx
     −   Beagleboard

    KISS concept
     −   Boot device and load kernel
Kernel Boot Time
Fullow the standard Kernel optimizing guide:
   http://elinux.org/Boot_Time

Minimize kernel size
Use compression or not
Enable embedded options
Avoid loading unneeded kernel module at boot time
Optimize Android Init
Parallize init tasks

    insmod cannot be parallized

    Use external scripts to init at background

Start services on demand
Optimize Class Preloading
Trade-off between preload class and application
startup time
Split class to more packages to reduce dependency
Save inited heap for later use
Share heaps between zygote and children
Filesystem Optimization
According to reasearch by Linaro Kernel WG
Use correct NAND configuration will improve the
performance
MMC controllers are often optimized for particular
usage / filesystem
Adjust the filesystem partition scheme
Toothpaste Effect
Observed by Sony Developer Tim Bird
“When you squeeze a tube of toothpaste, sometimes
it just moves the toothpaste somewhere else in the
tube, and nothing actually comes out.”
Q&A
Hibernation Based Technologies
QuickBoot
Developed by Japanese
company Ubiquitous
Demand loading of
required page from flash
Requires deep
integration of hardware
and software
Fast-On
Developed by CCU
Based on existing technologies thus requires little
modification to userspace
Release clean-pages before suspend
Swap out dirty-pages before save image
Image size reduced leads to faster resume time.
Android Wakelocks & TuxOnIce
TuxOnIce Patch
TuxOnIce (was Software Suspend 2) is a hibernation
patchset
Can save images to different locations
Can use different compresion algorithm
Porting to ARM is possible
Android Wakelocks
An aggressive approach to save device power
Use wakelocks to prevent device going suspend
Port TOI to Android have to deal with wakelocks
because MMC driver might hold a wakelock
Linux Suspend Architecture
Documentation/power/devices.txt:
  struct dev_pm_ops {
          int (*prepare)(struct device *dev);
          void (*complete)(struct device *dev);
          int (*suspend)(struct device *dev);
          int (*resume)(struct device *dev);
          int (*freeze)(struct device *dev);
          int (*thaw)(struct device *dev);
          int (*poweroff)(struct device *dev);
          int (*restore)(struct device *dev);
          int (*suspend_noirq)(struct device *dev);
          int (*resume_noirq)(struct device *dev);
          int (*freeze_noirq)(struct device *dev);
          int (*thaw_noirq)(struct device *dev);
          int (*poweroff_noirq)(struct device *dev);
          int (*restore_noirq)(struct device *dev);
          int (*runtime_suspend)(struct device *dev);
          int (*runtime_resume)(struct device *dev);
          int (*runtime_idle)(struct device *dev);
  };
Q&A
We Don't Need Boot-loader
R-Loader
Normal suspend-to-disk approach has many
duplicated effort

    Boot-loader inits some hardwares

    Boot-loader loads the normal kernel image

    Kernel inits some hardwares again

    Kernel loads the suspended kernel image

    Kernel resumes, inits some hardwares again
R-Loader
0xlab Developer Matt Proposed “Resume-Loader”
R-Loader inits some hardware then reads the
suspended kernel image as fast as possible
Jump directly to the resume point
Kernel will takeover the job and inits reset hardwares
Demo
Get 0xdroid 0x7 release
   https://code.google.com/p/0xdroid/wiki/0x7_leb_gingerbread

Get TOI Patch for 0x7 release
   https://gitorious.org/0xlab-kernel/kernel/commits/toi/linaro-android.38
Future Work and Conclusions
Save the heap image (like core dump) of Zygote after
preloading classes
Modify Dalvik to make hibernation image after system
init and before Launcher startup
Parallize Android init
Cache & Share JITed code fragment
Q&A
http://0xlab.org

Mais conteúdo relacionado

Mais procurados

Android Booting Sequence
Android Booting SequenceAndroid Booting Sequence
Android Booting SequenceJayanta Ghoshal
 
Shorten Device Boot Time for Automotive IVI and Navigation Systems
Shorten Device Boot Time for Automotive IVI and Navigation SystemsShorten Device Boot Time for Automotive IVI and Navigation Systems
Shorten Device Boot Time for Automotive IVI and Navigation SystemsNational Cheng Kung University
 
Understanding the Android System Server
Understanding the Android System ServerUnderstanding the Android System Server
Understanding the Android System ServerOpersys inc.
 
Booting Android: bootloaders, fastboot and boot images
Booting Android: bootloaders, fastboot and boot imagesBooting Android: bootloaders, fastboot and boot images
Booting Android: bootloaders, fastboot and boot imagesChris Simmonds
 
"Learning AOSP" - Android Hardware Abstraction Layer (HAL)
"Learning AOSP" - Android Hardware Abstraction Layer (HAL)"Learning AOSP" - Android Hardware Abstraction Layer (HAL)
"Learning AOSP" - Android Hardware Abstraction Layer (HAL)Nanik Tolaram
 
Android for Embedded Linux Developers
Android for Embedded Linux DevelopersAndroid for Embedded Linux Developers
Android for Embedded Linux DevelopersOpersys inc.
 
Android Binder IPC for Linux
Android Binder IPC for LinuxAndroid Binder IPC for Linux
Android Binder IPC for LinuxYu-Hsin Hung
 
Embedded Android Workshop with Pie
Embedded Android Workshop with PieEmbedded Android Workshop with Pie
Embedded Android Workshop with PieOpersys inc.
 
Using and Customizing the Android Framework / part 4 of Embedded Android Work...
Using and Customizing the Android Framework / part 4 of Embedded Android Work...Using and Customizing the Android Framework / part 4 of Embedded Android Work...
Using and Customizing the Android Framework / part 4 of Embedded Android Work...Opersys inc.
 
Android's HIDL: Treble in the HAL
Android's HIDL: Treble in the HALAndroid's HIDL: Treble in the HAL
Android's HIDL: Treble in the HALOpersys inc.
 

Mais procurados (20)

Android Things : Building Embedded Devices
Android Things : Building Embedded DevicesAndroid Things : Building Embedded Devices
Android Things : Building Embedded Devices
 
Embedded Android : System Development - Part IV
Embedded Android : System Development - Part IVEmbedded Android : System Development - Part IV
Embedded Android : System Development - Part IV
 
Low Level View of Android System Architecture
Low Level View of Android System ArchitectureLow Level View of Android System Architecture
Low Level View of Android System Architecture
 
Android Booting Sequence
Android Booting SequenceAndroid Booting Sequence
Android Booting Sequence
 
Shorten Device Boot Time for Automotive IVI and Navigation Systems
Shorten Device Boot Time for Automotive IVI and Navigation SystemsShorten Device Boot Time for Automotive IVI and Navigation Systems
Shorten Device Boot Time for Automotive IVI and Navigation Systems
 
Understanding the Android System Server
Understanding the Android System ServerUnderstanding the Android System Server
Understanding the Android System Server
 
Booting Android: bootloaders, fastboot and boot images
Booting Android: bootloaders, fastboot and boot imagesBooting Android: bootloaders, fastboot and boot images
Booting Android: bootloaders, fastboot and boot images
 
Introduction to Android Window System
Introduction to Android Window SystemIntroduction to Android Window System
Introduction to Android Window System
 
"Learning AOSP" - Android Hardware Abstraction Layer (HAL)
"Learning AOSP" - Android Hardware Abstraction Layer (HAL)"Learning AOSP" - Android Hardware Abstraction Layer (HAL)
"Learning AOSP" - Android Hardware Abstraction Layer (HAL)
 
Embedded Android : System Development - Part II (Linux device drivers)
Embedded Android : System Development - Part II (Linux device drivers)Embedded Android : System Development - Part II (Linux device drivers)
Embedded Android : System Development - Part II (Linux device drivers)
 
Android for Embedded Linux Developers
Android for Embedded Linux DevelopersAndroid for Embedded Linux Developers
Android for Embedded Linux Developers
 
Android Binder IPC for Linux
Android Binder IPC for LinuxAndroid Binder IPC for Linux
Android Binder IPC for Linux
 
Android Internals
Android InternalsAndroid Internals
Android Internals
 
Embedded Android Workshop with Pie
Embedded Android Workshop with PieEmbedded Android Workshop with Pie
Embedded Android Workshop with Pie
 
Android Internals
Android InternalsAndroid Internals
Android Internals
 
Hacking Android OS
Hacking Android OSHacking Android OS
Hacking Android OS
 
Using and Customizing the Android Framework / part 4 of Embedded Android Work...
Using and Customizing the Android Framework / part 4 of Embedded Android Work...Using and Customizing the Android Framework / part 4 of Embedded Android Work...
Using and Customizing the Android Framework / part 4 of Embedded Android Work...
 
Android's HIDL: Treble in the HAL
Android's HIDL: Treble in the HALAndroid's HIDL: Treble in the HAL
Android's HIDL: Treble in the HAL
 
Porting Android
Porting AndroidPorting Android
Porting Android
 
Android : Deep dive into developing MobileApp using Android
Android : Deep dive into developing MobileApp using AndroidAndroid : Deep dive into developing MobileApp using Android
Android : Deep dive into developing MobileApp using Android
 

Destaque

Hardware Abstraction Layer
Hardware Abstraction LayerHardware Abstraction Layer
Hardware Abstraction LayerTeh Kian Cheng
 
Diving inside Android Wifi
Diving inside Android WifiDiving inside Android Wifi
Diving inside Android WifiNanik Tolaram
 
HKG15-409: ARM Hibernation enablement on SoCs - a case study
HKG15-409: ARM Hibernation enablement on SoCs - a case studyHKG15-409: ARM Hibernation enablement on SoCs - a case study
HKG15-409: ARM Hibernation enablement on SoCs - a case studyLinaro
 
Android HAL Introduction: libhardware and its legacy
Android HAL Introduction: libhardware and its legacyAndroid HAL Introduction: libhardware and its legacy
Android HAL Introduction: libhardware and its legacyJollen Chen
 
Hibernation in Linux 2.6.29
Hibernation in Linux 2.6.29Hibernation in Linux 2.6.29
Hibernation in Linux 2.6.29Varun Mahajan
 
Qi -- Lightweight Boot Loader Applied in Mobile and Embedded Devices
Qi -- Lightweight Boot Loader Applied in Mobile and Embedded DevicesQi -- Lightweight Boot Loader Applied in Mobile and Embedded Devices
Qi -- Lightweight Boot Loader Applied in Mobile and Embedded DevicesNational Cheng Kung University
 
nl80211 and libnl
nl80211 and libnlnl80211 and libnl
nl80211 and libnlawkman
 
Debian & the BeagleBone Black
Debian & the BeagleBone BlackDebian & the BeagleBone Black
Debian & the BeagleBone BlackRaju Vindane
 
COS: A Configurable OS for Embedded SoC Systems
COS: A Configurable OS for Embedded SoC SystemsCOS: A Configurable OS for Embedded SoC Systems
COS: A Configurable OS for Embedded SoC SystemsPrateek Anand
 
Connecting Hardware to the Web with the BeagleBone
Connecting Hardware to the Web with the BeagleBoneConnecting Hardware to the Web with the BeagleBone
Connecting Hardware to the Web with the BeagleBoneFrank Hunleth
 
Android power management
Android power managementAndroid power management
Android power managementJerrin George
 
BeagleBone Black Using Python
BeagleBone Black Using PythonBeagleBone Black Using Python
BeagleBone Black Using PythonSai Viswanath
 
Android device driver structure introduction
Android device driver structure introductionAndroid device driver structure introduction
Android device driver structure introductionWilliam Liang
 
Accessing Hardware on Android
Accessing Hardware on AndroidAccessing Hardware on Android
Accessing Hardware on AndroidGary Bisson
 

Destaque (20)

Hardware Abstraction Layer
Hardware Abstraction LayerHardware Abstraction Layer
Hardware Abstraction Layer
 
Diving inside Android Wifi
Diving inside Android WifiDiving inside Android Wifi
Diving inside Android Wifi
 
Android Custom Kernel/ROM design
Android Custom Kernel/ROM designAndroid Custom Kernel/ROM design
Android Custom Kernel/ROM design
 
HKG15-409: ARM Hibernation enablement on SoCs - a case study
HKG15-409: ARM Hibernation enablement on SoCs - a case studyHKG15-409: ARM Hibernation enablement on SoCs - a case study
HKG15-409: ARM Hibernation enablement on SoCs - a case study
 
Android HAL Introduction: libhardware and its legacy
Android HAL Introduction: libhardware and its legacyAndroid HAL Introduction: libhardware and its legacy
Android HAL Introduction: libhardware and its legacy
 
Hibernation in Linux 2.6.29
Hibernation in Linux 2.6.29Hibernation in Linux 2.6.29
Hibernation in Linux 2.6.29
 
Implement Checkpointing for Android (ELCE2012)
Implement Checkpointing for Android (ELCE2012)Implement Checkpointing for Android (ELCE2012)
Implement Checkpointing for Android (ELCE2012)
 
Qi -- Lightweight Boot Loader Applied in Mobile and Embedded Devices
Qi -- Lightweight Boot Loader Applied in Mobile and Embedded DevicesQi -- Lightweight Boot Loader Applied in Mobile and Embedded Devices
Qi -- Lightweight Boot Loader Applied in Mobile and Embedded Devices
 
nl80211 and libnl
nl80211 and libnlnl80211 and libnl
nl80211 and libnl
 
Debian & the BeagleBone Black
Debian & the BeagleBone BlackDebian & the BeagleBone Black
Debian & the BeagleBone Black
 
COS: A Configurable OS for Embedded SoC Systems
COS: A Configurable OS for Embedded SoC SystemsCOS: A Configurable OS for Embedded SoC Systems
COS: A Configurable OS for Embedded SoC Systems
 
Connecting Hardware to the Web with the BeagleBone
Connecting Hardware to the Web with the BeagleBoneConnecting Hardware to the Web with the BeagleBone
Connecting Hardware to the Web with the BeagleBone
 
BeagleBone Workshop
BeagleBone WorkshopBeagleBone Workshop
BeagleBone Workshop
 
Beagle board
Beagle boardBeagle board
Beagle board
 
How To Build Android for ARM Chip boards
How To Build Android for ARM Chip boardsHow To Build Android for ARM Chip boards
How To Build Android for ARM Chip boards
 
Android power management
Android power managementAndroid power management
Android power management
 
BeagleBone Black Using Python
BeagleBone Black Using PythonBeagleBone Black Using Python
BeagleBone Black Using Python
 
Android device driver structure introduction
Android device driver structure introductionAndroid device driver structure introduction
Android device driver structure introduction
 
Android Booting Scenarios
Android Booting ScenariosAndroid Booting Scenarios
Android Booting Scenarios
 
Accessing Hardware on Android
Accessing Hardware on AndroidAccessing Hardware on Android
Accessing Hardware on Android
 

Semelhante a Android Boot Time Optimization Techniques

Rloader, alternative tech to achieve fast boot time for ARM Linux
Rloader, alternative tech to achieve fast boot time for ARM LinuxRloader, alternative tech to achieve fast boot time for ARM Linux
Rloader, alternative tech to achieve fast boot time for ARM Linuxmatt_hsu
 
Fast boot
Fast bootFast boot
Fast bootSZ Lin
 
HKG18-TR14 - Postmortem Debugging with Coresight
HKG18-TR14 - Postmortem Debugging with CoresightHKG18-TR14 - Postmortem Debugging with Coresight
HKG18-TR14 - Postmortem Debugging with CoresightLinaro
 
Android crash debugging
Android crash debuggingAndroid crash debugging
Android crash debuggingAshish Agrawal
 
Labs_BT_20221017.pptx
Labs_BT_20221017.pptxLabs_BT_20221017.pptx
Labs_BT_20221017.pptxssuserb4d806
 
Kernel debug log and console on openSUSE
Kernel debug log and console on openSUSEKernel debug log and console on openSUSE
Kernel debug log and console on openSUSESUSE Labs Taipei
 
Kernel Recipes 2015 - Kernel dump analysis
Kernel Recipes 2015 - Kernel dump analysisKernel Recipes 2015 - Kernel dump analysis
Kernel Recipes 2015 - Kernel dump analysisAnne Nicolas
 
Containers with systemd-nspawn
Containers with systemd-nspawnContainers with systemd-nspawn
Containers with systemd-nspawnGábor Nyers
 
Linux kernel tracing superpowers in the cloud
Linux kernel tracing superpowers in the cloudLinux kernel tracing superpowers in the cloud
Linux kernel tracing superpowers in the cloudAndrea Righi
 
Renesas DevCon 2010: Starting a QT Application with Minimal Boot
Renesas DevCon 2010: Starting a QT Application with Minimal BootRenesas DevCon 2010: Starting a QT Application with Minimal Boot
Renesas DevCon 2010: Starting a QT Application with Minimal Bootandrewmurraympc
 
Android porting for dummies @droidconin 2011
Android porting for dummies @droidconin 2011Android porting for dummies @droidconin 2011
Android porting for dummies @droidconin 2011pundiramit
 
Kafka Summit SF 2017 - One Day, One Data Hub, 100 Billion Messages: Kafka at ...
Kafka Summit SF 2017 - One Day, One Data Hub, 100 Billion Messages: Kafka at ...Kafka Summit SF 2017 - One Day, One Data Hub, 100 Billion Messages: Kafka at ...
Kafka Summit SF 2017 - One Day, One Data Hub, 100 Billion Messages: Kafka at ...confluent
 
Best Practices for performance evaluation and diagnosis of Java Applications ...
Best Practices for performance evaluation and diagnosis of Java Applications ...Best Practices for performance evaluation and diagnosis of Java Applications ...
Best Practices for performance evaluation and diagnosis of Java Applications ...IndicThreads
 
YOW2020 Linux Systems Performance
YOW2020 Linux Systems PerformanceYOW2020 Linux Systems Performance
YOW2020 Linux Systems PerformanceBrendan Gregg
 
Container Performance Analysis Brendan Gregg, Netflix
Container Performance Analysis Brendan Gregg, NetflixContainer Performance Analysis Brendan Gregg, Netflix
Container Performance Analysis Brendan Gregg, NetflixDocker, Inc.
 
Early Software Development through Palladium Emulation
Early Software Development through Palladium EmulationEarly Software Development through Palladium Emulation
Early Software Development through Palladium EmulationRaghav Nayak
 
Container Performance Analysis
Container Performance AnalysisContainer Performance Analysis
Container Performance AnalysisBrendan Gregg
 

Semelhante a Android Boot Time Optimization Techniques (20)

Rloader, alternative tech to achieve fast boot time for ARM Linux
Rloader, alternative tech to achieve fast boot time for ARM LinuxRloader, alternative tech to achieve fast boot time for ARM Linux
Rloader, alternative tech to achieve fast boot time for ARM Linux
 
Fast boot
Fast bootFast boot
Fast boot
 
HKG18-TR14 - Postmortem Debugging with Coresight
HKG18-TR14 - Postmortem Debugging with CoresightHKG18-TR14 - Postmortem Debugging with Coresight
HKG18-TR14 - Postmortem Debugging with Coresight
 
Android crash debugging
Android crash debuggingAndroid crash debugging
Android crash debugging
 
Labs_BT_20221017.pptx
Labs_BT_20221017.pptxLabs_BT_20221017.pptx
Labs_BT_20221017.pptx
 
Kernel debug log and console on openSUSE
Kernel debug log and console on openSUSEKernel debug log and console on openSUSE
Kernel debug log and console on openSUSE
 
Kernel Recipes 2015 - Kernel dump analysis
Kernel Recipes 2015 - Kernel dump analysisKernel Recipes 2015 - Kernel dump analysis
Kernel Recipes 2015 - Kernel dump analysis
 
Containers with systemd-nspawn
Containers with systemd-nspawnContainers with systemd-nspawn
Containers with systemd-nspawn
 
Linux kernel tracing superpowers in the cloud
Linux kernel tracing superpowers in the cloudLinux kernel tracing superpowers in the cloud
Linux kernel tracing superpowers in the cloud
 
Renesas DevCon 2010: Starting a QT Application with Minimal Boot
Renesas DevCon 2010: Starting a QT Application with Minimal BootRenesas DevCon 2010: Starting a QT Application with Minimal Boot
Renesas DevCon 2010: Starting a QT Application with Minimal Boot
 
Android porting for dummies @droidconin 2011
Android porting for dummies @droidconin 2011Android porting for dummies @droidconin 2011
Android porting for dummies @droidconin 2011
 
Kafka Summit SF 2017 - One Day, One Data Hub, 100 Billion Messages: Kafka at ...
Kafka Summit SF 2017 - One Day, One Data Hub, 100 Billion Messages: Kafka at ...Kafka Summit SF 2017 - One Day, One Data Hub, 100 Billion Messages: Kafka at ...
Kafka Summit SF 2017 - One Day, One Data Hub, 100 Billion Messages: Kafka at ...
 
Best Practices for performance evaluation and diagnosis of Java Applications ...
Best Practices for performance evaluation and diagnosis of Java Applications ...Best Practices for performance evaluation and diagnosis of Java Applications ...
Best Practices for performance evaluation and diagnosis of Java Applications ...
 
YOW2020 Linux Systems Performance
YOW2020 Linux Systems PerformanceYOW2020 Linux Systems Performance
YOW2020 Linux Systems Performance
 
Kernel Debugging & Profiling
Kernel Debugging & ProfilingKernel Debugging & Profiling
Kernel Debugging & Profiling
 
Ch04 system administration
Ch04 system administration Ch04 system administration
Ch04 system administration
 
Ch04
Ch04Ch04
Ch04
 
Container Performance Analysis Brendan Gregg, Netflix
Container Performance Analysis Brendan Gregg, NetflixContainer Performance Analysis Brendan Gregg, Netflix
Container Performance Analysis Brendan Gregg, Netflix
 
Early Software Development through Palladium Emulation
Early Software Development through Palladium EmulationEarly Software Development through Palladium Emulation
Early Software Development through Palladium Emulation
 
Container Performance Analysis
Container Performance AnalysisContainer Performance Analysis
Container Performance Analysis
 

Último

How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhisoniya singh
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?XfilesPro
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 

Último (20)

How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping Elbows
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 

Android Boot Time Optimization Techniques

  • 1. Connect your device to application
  • 2. Android Boot Time Optimization Kan-Ru Chen kanru@0xlab.org Sep 09, 2011
  • 3. Agenda Motivation Boot Time Measurement Android Boot Time Analysis Reduction Approach Hibernation Based Technologies We Don't Need Boot-loader Demo Future Work and Conclusions
  • 7. Printk Times Linux kernel feature Built-in since Linux 2.6.11 How to enable?  Add CONFIG_PRINTK_TIME=y to .config  Or choose from menuconfig Kernel hacking ---> [*] Show timing information on printks
  • 8. Printk Times Output Example linux$ dmesg [0.000000] per task-struct memory footprint: 1152 bytes [0.003692] Calibrating delay loop... 506.27 BogoMIPS (lpj=1978368) [0.079833] pid_max: default: 32768 minimum: 301 [0.080230] Security Framework initialized [0.080474] Mount-cache hash table entries: 512 [0.083892] CPU: Testing write buffer coherency: ok Analysis Tool linux$ dmesg > timefile linux$ scripts/show_delta timefile ... [0.194488 < 0.194488 >] OMAP DMA hardware revision 5.0 [0.259948 < 0.065460 >] bio: create slab <bio-0> at 0 [0.267822 < 0.007874 >] SCSI subsystem initialized ...
  • 9. initcall_debug Kernel Parameter Print the time spent for each initcall Output Example calling ipc_init+0x0/0x28 @ 1 msgmni has been set to 42 initcall ipc_init+0x0/0x28 returned 0 after 1872 usecs
  • 10. Bootchart Visualize the booting process Use “bootchartd” to collect CPU and IO utilization information. On Ubuntu: apt-get install bootchart bootchart-view Original “bootchartd” is not suitable for embedded usage.
  • 12. Strace Trace system calls during process execution and output timing information. $ strace -tt ls 15:11:04.243357 execve("/bin/ls", ["ls"], [/* 51 vars */]) = 0 15:11:04.244252 brk(0) = 0x234f000 15:11:04.244458 access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT 15:11:04.244676 mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE| MAP_ANONYMOUS, -1, 0) = 0x7f1444794000 15:11:04.244852 access("/etc/ld.so.preload", R_OK) = -1 ENOENT 15:11:04.245096 open("/etc/ld.so.cache", O_RDONLY) = 3
  • 13. OProfile OProfile is a system-wide profiler for Linux systems. Capable of profiling all running code at low overhead. Supports wide number of hardwares. Profiling daemon ported to Android and available in AOSP.
  • 14. OProfile Output Example $ opreport --exclude-dependent CPU: PIII, speed 863.195 MHz (estimated) Counted CPU_CLK_UNHALTED events (clocks processor is not halted)... 450385 75.6634 cc1plus 60213 10.1156 lyx 29313 4.9245 XFree86 11633 1.9543 as 10204 1.7142 oprofiled 7289 1.2245 vmlinux 7066 1.1871 bash 6417 1.0780 oprofile 6397 1.0747 vim ...
  • 15. Perf New profiling tool based on the performance counter subsystem of Linux. Very powerful and easy to use. Included in Linux source code: tools/perf/
  • 16. Perf Recording: $ perf record -a -f ^C [ perf record: Woken up 1 times to write data ] [ perf record: Captured and wrote 0.288 MB perf.data (~12567 samples)] Output $ perf report --sort comm,dso,symbol|head -10 # Events: 1K cycles # # Overhead Command Shared Object Symbol # ........ ........... ...................... ............ # 35.47% firefox libxul.so [.] 0xc1b3a7 3.08% firefox libcairo.so.2.11000.2 [.] 0xff88 2.98% Xorg Xorg (deleted) [.] 0xe201c 2.51% firefox firefox [.] 0x2726 1.49% Xorg [kernel.kallsyms] [k] find_vma 0.93% perf_3.0.0 perf_3.0.0 [.] hex2u64
  • 17. Perf Timechart $ perf timechart record $ perf timechart
  • 19. Bootchart Original “bootchartd” is not suitable on embedded devices. Android re-implemented in its “init” program.
  • 20. Bootchart To build: $ cd system/core/init $ touch init.c $ mm INIT_BOOTCHART=true
  • 21. Bootchart To run: $ adb shell 'echo 120 > /data/bootchart-start' Remember the /data directory must be write able during boot. Use grab-bootchart.sh to retrieve the data.
  • 22. Strace After analyzed the bootchart, can use strace to analyze individual progarm. Available in AOSP since Éclair
  • 23. Strace Modify init.rc from service zygote /system/bin/app_process -Xzygote /system/bin --zygote --start-system-server To service zygote /system/xbin/strace -tt -o/data/boot.strace /system/bin/app_process -Xzygote /system/bin --zygote --start-system-server
  • 24. Logcat Android log utility Can output timing information Adjust loglevel to 6 in init.rc  Displays time spent for each command
  • 25. Dalvik Method Tracer Method tracer is built into Dalvik Use DDMS or using calls inside source to collect data. // start tracing to "/sdcard/calc.trace" Debug.startMethodTracing("calc"); // ... // stop tracing Debug.stopMethodTracing();
  • 26. Stopwatch Not real stopwatch A utility in Android Framework for measuring C++ code. Output result to system log #include <utils/StopWatch.h> … { StopWatch watch("blah"); /* your codes here */ }
  • 27. Q&A
  • 28. Android Boot Time Analysis
  • 29. Boot-loader Init Usually constant time Avoid init hardware multiple times Ensure to use maximum CPU frequency Use faster NAND/MMC reading mechanism
  • 30. Kernel Init Mostly usual suspects  ip_auto_config  USB init  Flash driver initialization Fullow the standard Kernel optimizing guide:  http://elinux.org/Boot_Time Avoid loading unneeded kernel module at boot time
  • 31. Zygote Class Preloading Android Framework has thousands of Java classes Preloaded by Zygote and instantiated in its heap To improve Application startup time and save memory Controlled by resource: preloaded-classes  frameworks/base/preloaded-classes
  • 32. Zygote Class Preloading Can use the tool in framework to adjust the list: $ adb logcat > logcat.txt $ java -p preload.jar Compile logcat.txt logcat.compiled $ java -p preload.jar PrintCsv logcat.compiled Google Android Developer Dianne Hackborn said:  The content of the file is a “black art”  You can adjust this as much as you like  But the result maybe suboptimal
  • 33. PackageManager Package Scannig Every APK is scanned at boot time Package management code is inefficient Uses mmaped files means each access will cause page fault ParseZipArchive() scans entire APK for only one AndroidManifest.xml file
  • 34. System Services Starting Last stage of Android boot Start every base service Zygote start SystemServer process Start native service (SurfaceFlinger, AudioFlinger) first Start each service sequentially
  • 35. Q&A
  • 37. Boot-loader Improve U-Boot  Reading multi-mmc-block  Cache (I/D) enablement  Optimize CRC32  Disable verification
  • 38. Boot-loader Qi Boot-loader Qi U-Boot + XLoader Boot-oader Size ~30K ~270K+20K  Only one stage boot-loader Time to Kernel <1s > 5s  Small footprint ~30K Usage Product Engineering Code Simple Complicated  Currently support − iMX31 − Samsung 24xx − Beagleboard  KISS concept − Boot device and load kernel
  • 39. Kernel Boot Time Fullow the standard Kernel optimizing guide:  http://elinux.org/Boot_Time Minimize kernel size Use compression or not Enable embedded options Avoid loading unneeded kernel module at boot time
  • 40. Optimize Android Init Parallize init tasks  insmod cannot be parallized  Use external scripts to init at background Start services on demand
  • 41. Optimize Class Preloading Trade-off between preload class and application startup time Split class to more packages to reduce dependency Save inited heap for later use Share heaps between zygote and children
  • 42. Filesystem Optimization According to reasearch by Linaro Kernel WG Use correct NAND configuration will improve the performance MMC controllers are often optimized for particular usage / filesystem Adjust the filesystem partition scheme
  • 43. Toothpaste Effect Observed by Sony Developer Tim Bird “When you squeeze a tube of toothpaste, sometimes it just moves the toothpaste somewhere else in the tube, and nothing actually comes out.”
  • 44. Q&A
  • 46. QuickBoot Developed by Japanese company Ubiquitous Demand loading of required page from flash Requires deep integration of hardware and software
  • 47. Fast-On Developed by CCU Based on existing technologies thus requires little modification to userspace Release clean-pages before suspend Swap out dirty-pages before save image Image size reduced leads to faster resume time.
  • 49. TuxOnIce Patch TuxOnIce (was Software Suspend 2) is a hibernation patchset Can save images to different locations Can use different compresion algorithm Porting to ARM is possible
  • 50. Android Wakelocks An aggressive approach to save device power Use wakelocks to prevent device going suspend Port TOI to Android have to deal with wakelocks because MMC driver might hold a wakelock
  • 51. Linux Suspend Architecture Documentation/power/devices.txt: struct dev_pm_ops { int (*prepare)(struct device *dev); void (*complete)(struct device *dev); int (*suspend)(struct device *dev); int (*resume)(struct device *dev); int (*freeze)(struct device *dev); int (*thaw)(struct device *dev); int (*poweroff)(struct device *dev); int (*restore)(struct device *dev); int (*suspend_noirq)(struct device *dev); int (*resume_noirq)(struct device *dev); int (*freeze_noirq)(struct device *dev); int (*thaw_noirq)(struct device *dev); int (*poweroff_noirq)(struct device *dev); int (*restore_noirq)(struct device *dev); int (*runtime_suspend)(struct device *dev); int (*runtime_resume)(struct device *dev); int (*runtime_idle)(struct device *dev); };
  • 52. Q&A
  • 53. We Don't Need Boot-loader
  • 54. R-Loader Normal suspend-to-disk approach has many duplicated effort  Boot-loader inits some hardwares  Boot-loader loads the normal kernel image  Kernel inits some hardwares again  Kernel loads the suspended kernel image  Kernel resumes, inits some hardwares again
  • 55. R-Loader 0xlab Developer Matt Proposed “Resume-Loader” R-Loader inits some hardware then reads the suspended kernel image as fast as possible Jump directly to the resume point Kernel will takeover the job and inits reset hardwares
  • 56. Demo Get 0xdroid 0x7 release  https://code.google.com/p/0xdroid/wiki/0x7_leb_gingerbread Get TOI Patch for 0x7 release  https://gitorious.org/0xlab-kernel/kernel/commits/toi/linaro-android.38
  • 57. Future Work and Conclusions Save the heap image (like core dump) of Zygote after preloading classes Modify Dalvik to make hibernation image after system init and before Launcher startup Parallize Android init Cache & Share JITed code fragment
  • 58. Q&A