Transcript 1112

Booting, Browsing and Streaming Time
Profiling and Bottleneck Analysis on
Android-Based Systems
Student: Buzz Tu
Advisor: Dr. Ying-Dar Lin
Date: 2010/01/07
Outline

Motivation/Introduction










Popular Android
Booting time/Browsing
Android Architecture
Define Booting Time
Android Booting Procedure
Boot methods on Android
Problem Statement and Objectives
Related Papers/Tools
Measurement Architecture
Measure Methods

Code Instrumentation
 Bootchart
 Booting Procedure dependence



Booting time Analysis
Reducing Method
References
2
Popular Android

Trend
 Android
Smartphone shipments will grow 900%
in 2009
 Lot of leading companies have announced new
products for Android

Open
 Open
source
 Open development environment
 Platform independent

MID, GPS, Netbook, Smartphone,…etc
3
Booting Time measurement

Booting Time
 First
perception of a new consumer product
 Comparison between different Smartphones
Product name
CPU
RAM(MB) Architecture
OS
boot time(sec)
htc G1
Qualcomm MSM7201A 528MHz
192
ARM11
Android 1.5
53
htc hero
Qualcomm MSM7200A 528MHz
288
ARM11
Android 1.5
68
htc magic
Qualcomm MSM7200A 528MHz
288
ARM11
Android 1.5
58
Samsung i7500 Qualcomm MSM7200A 528MHz
128
ARM11
Android 1.5
60
iPhone3G S
ARM Cortex A8 600MHz
256
ARM Cortex
iPhone OS 3.1
19.34
Nokia N97
ARM 11 434MHz
128
ARM11
Symbian OS v9.4
27
 Why
Android boots so slowly?
4
Browser compare on Handheld dev

Browser compare
HTC hero
iphone 3G
iphone 3Gs
mid
low
fast
Browsing
low
(zoom in/out, sliding)
mid
fast
Load same page
 Need
to know where the Bottleneck is in rending.
5
Android Architecture

Architecture difference between Android and GNU/Linux
APPLICATIONS
APPLICATION FRAMEWORK
APPLICATIONS
Libraries
Libraries
Android run time
LINUX KERNEL
LINUX KERNEL
Hardware
Hardware
6
Define Booting Time


Starting point: Users press the power-on button
End point : Home screen a
button pressed
HW init/boot ROM
Boot loader
Kernel
User space
First avail use
7
Booting Procedure on Android

Booting Procedure on Android
12
6
1
Poweron
2
Boot
ROM
3
4
Service
Manager
7
Boot
Loader
Kernel
5
init
vold
adbd
rild
Debuggerd
..
8
Zygote
9
Dalvik
10
System
Server
11
[Surface,Audio]
Flinger
13
Dalvik(home)
Services/Managers:
Power manager
Activity manager
Telephony registry
Package manager
Account manager
Content manager
Hardware service
Power service
Watchdog
Sensor service
Window manager
Bluetooth
..
14
First available use
8
About Booting on Android
Normal Boot
Normal suspend tech
Quickboot tech
Boot time
50~70sec
1xsec
1sec
Size load into MEM
105~110M
105~110MB
10M
pros
stable
engineering stage
engineering stage
Cons
slow
N/A
N/A
restrict
N/A
S4 tech
Need MMU,S4 tech
9
Quick Boot Tech on Android

Load partial data & suspend tech for quick boot
以上內容來自 <http://big5.nikkeibp.com.cn/news/digi/49274-20091214.html>
10
Browsing action procedure(on-going)

From user touch screen to browser
11
Problem Statement and Objectives

Problem statement


Using appropriate profiling tech/tools to measure the normal
Booting time, Browsing lag and Streaming time problem on
Android-Based Systems.
Objective



Find profiling tech/tools to profile “Booting” and “Browsing” Time
Identify the bottleneck of Booting and Browsing Time
Analyze & Reduce the Booting & Browsing Time
12
Related Papers/tools(on-going)
Paper Observation
cons
Using Tools
7,8
• Many parts of booting stage could be
reduce by different method
•SOP of using oscillator & logical
analyzer on measuring the Linux booting
•Decrease kernel booting time from
7934us to 1477us on OMAP5912OSK
•Didn’t include user space part
•oscillator,
•Logical analyzer
•KFT
•printk()
11
Provide a parallel profile analysis
framework
•complexity in operation
•Paraprof
13
Measurement Architecture(1/2)

Android development 1

Kernel space:




KFT
printk
rdtscll
button pressed
User space:


ddms
Bootchart
HW init/boot ROM
Boot loader
Kernel
KFT, printk,
rdtscll
User space
First avail use
ddms,Bootchart,
code instrumentation
14
Measurement Architecture(2/2)

X86(eeepc)

Kernel space:




KFT
printk
rdtscll
User space:


ddms
Bootchart
button pressed
HW init/boot ROM
Boot loader
Kernel
User space
First avail use
KFT, printk,
rdtscll
ddms,Bootchart,
code instrumentation
15
Cross layer profiling
layer
language Profiling tools
Application
Java
•Traceview with code instrumented,
•Monkey with hprof
Dalvik VM
Java,C++
•ddms with code instrumentation
JNI
C++,C
•ddms with code instrumentation
System(lib, kernel) C++,C

Integration benefit



•oprofile
•dmesg with code instrumentation
Reduce code optimization time
Quick detect system-wide performance issue
Integration issue


Time synchronization
Log centralization
16
Code Instrumentation

Daemon write by C program


Service/AP write by java



include “cutils/log.h”
LOGI(“my_log_message”);
Import android.util.Log
private static final String TAG = “myTAG_name";
Log.v(TAG, “my_log_message”);
Check log from ddms/catlog/dmesg/traceview
Issue

Log decentralize


init log: /proc/kmsg (fetch by dmesg )
Service & daemon log : /dev/log/main (fetch by catlog)
17
Bootchart
1:System prepare stage
4:HomeLoad(boot completed)
2:VM env prepare stage
3:load Android services/management stage
Time sequence
18
Booting Procedure measurement
 Base
9sec
on Android Dev1 with Android 2.0
37.5sec
6
1
Poweron
2
Boot
ROM
3
4
12
Service
Manager
7
Boot
Loader
Kernel
5
init
vold
adbd
rild
Debuggerd
..
8
Zygote
9
Dalvik
10
System
Server
11
[Surface,Audio]
Flinger
13
Dalvik(home)
Services/Managers:
Power manager
Activity manager
Telephony registry
Package manager
Account manager
Content manager
Hardware service
Power service
Watchdog
Sensor service
Window manager
Bluetooth
..
14
First available use
19
Booting Procedure dependence

Init
Dependence(from init to home)
adbd
systemserver
servicemanager
PowerManager
Telephony registry
SystemContentManager
WindowManager
AccessibilityManager
CheckinService
HomeLoader
rild
zygote
ActivityManager
PackageManager
BatteryService
StatusBarService
Boot done
PowerManager
AccountManager
ContentManager
HardwareService
SensorService
InputMethodService
NotificationManager
WallpaperService
preload classes/resources
LocationManager
AudioService
ConnectivityService
SearchService
AppWidgetService
20
Booting Time Analysis(1/2)

Overhead of Bootchart: 7.89%
Bootchart w/o Bootchart
Booting time

51.1sec
47.32sec
Define the period of user space
 Start
point: “init process start”
 End point: “HomeLoaders”
Bootloader+kernel User space
total
Booting time
9.52sec
37.8sec
47.32sec
ratio
21%
79%
100%
21
Booting Time Analysis(2/2)
Android Booting Time
hardware init
+ bootloader
9%
kernel
11%
Services /
managers
36%
init/system
prepare
4%
VM
environment
40%
Need improve
Next:Devide into loading and running
22
Reducing methods
Reduce unusable process/services
 Disable verbose log/decrease log level
 “first available use window” appear ASAP

 Let

some services load after boot
Predefine Boot image
 “suspend
to disk” tech(whole MEM to Disk)
 Make partial step of init procedure image(
need study feasibility )
23
References
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
Mattias, “The Android boot process from power on,”
http://androidenea.blogspot.com/2009/06/android-boot-process-from-poweron.html, Jun 2009.
Walkingice, “How Android Differs from GNU/LINUX?,”
http://walkingice.twbbs.org/~walkingice/files/document/coscup_2009_walkingice.p
df , COSCUP, August 2009.
Patrick Brady, “Anatomy & Physiology of an Android,”
http://sites.google.com/site/io/anatomy--physiology-of-an-android, 2008.
Wen-chang Chung, “The Study and Implement of Operating System Porting for
Android,” Master Thesis, National Taipei University of Technology, 2009.
Florian Strunk, Robert Baumgartl, ”An Analysis of Linux Boot Times,” Chemnitz
University of Technology, Mar 2008.
Camellia Ghoroghi, Tannaz Alinaghi, “An introduction to profiling mechanisms and
Linux profilers,” University of Tehran, Nov 2006.
Chih-Chien Yang, “An Empirical Analysis of Embedded Linux Kernel 2.6.14 to
Achieve Faster Boot Time,” Master Thesis, National Chiao-Tung University, 2006.
Chien-Ming Huang, “A Timing Analysis of Booting Procedures on Embedded Linux
Systems,” Master Thesis, National Chiao-Tung University, 2006.
Cheng-Wei Li, “Construct A Fast-Boot Embedded System by Predefined Boot
Image,” CCL TECHNICAL JOURNAL, 2005.
Andy Pfiffer,” Reducing System Reboot Time With kexec,” Open Source
Development Labs, Inc, 2003.
Robert Bell,”ParaProf: A Protable, Extensible, and Scalable Tool for Parallel
24
Performance Profile Analysis,” Springer-Verlag Berlin Heidelberg, 2003