1112 - High Speed Network Lab @ NCTU

Architecture difference between Android and GNU/Linux ... Boot loader ... SOP of using oscillator & logical analyzer on measuring the Linux booting; Decrease ...

1. Booting, Browsing and Streaming Time Profiling and Bottleneck Analysis on An droid-Based Systems Student: Buzz Tu Advisor: Dr. Ying-Dar Lin Date: 2010/01/07

2.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

3.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

4. Booting Time measurement  Booting Time  First perception of a new consumer product  Comparison between different Smartphones Architectu boot Product name CPU RAM(MB) OS re 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 Qualcomm MSM7200A 528MHz 128 ARM11 Android 1.5 60 i7500 iPhone3G S ARM Cortex A8 600MHz 256 ARM Cortex iPhone OS 3.1 19.34 Symbian OS Nokia N97 ARM 11 434MHz 128 ARM11 27 v9.4  Why Android boots so slowly? 4

5. Browser compare on Handheld dev  Browser compare HTC hero iphone 3G iphone 3Gs Load same page mid low fast Browsing low mid fast (zoom in/out, sliding)  Need to know where the Bottleneck is in rending. 5

6.Android Architecture  Architecture difference between Android and GNU/Linux APPLICATIONS APPLICATION FRAMEWORK APPLICATIONS Libraries Android run time Libraries LINUX KERNEL LINUX KERNEL Hardware Hardware 6

7.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

8. Booting Procedure on Android  Booting Procedure on Android 12 6 Services/Managers: Service Power manager 1 Poweron Manager Activity manager 7 Telephony registry vold Package manager Boot Account manager 2 ROM adbd rild Content manager 5 Hardware service Debuggerd Boot .. Power service 3 Loader init 10 11 Watchdog 8 9 Sensor service System [Surface,Audio] Window manager 4 Kernel Zygote Dalvik Server Flinger Bluetooth .. 13 14 Dalvik(home) First available use 8

9. 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

10.Quick Boot Tech on Android  Load partial data & suspend tech for quick boot 以上內容來自 <http://big5.nikkeibp.com.cn/news/digi/49274-20091214.html> 10

11.Browsing action procedure(on-going)  From user touch screen to browser 11

12.Problem Statement and Objectives  Problem statement  Using appropriate profiling tech/tools to measure the normal Bootin g time, Browsing lag and Streaming time problem on Android-Base d 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

13. Related Papers/tools(on-going) Paper Observation cons Using Tools 7,8 • Many parts of booting stage could be •Didn’t include user space part •oscillator, reduce by different method •Logical analyzer •SOP of using oscillator & logical •KFT analyzer on measuring the Linux booting •printk() •Decrease kernel booting time from 7934us to 1477us on OMAP5912OSK 11 Provide a parallel profile analysis •complexity in operation •Paraprof framework 13

14.Measurement Architecture(1/2)  Android development 1  Kernel space:  KFT  printk  rdtscll button pressed  User space:  ddms HW init/boot ROM  Bootchart Boot loader Kernel KFT, printk, rdtscll User space ddms,Bootchart, First avail use code instrumentation 14

15.Measurement Architecture(2/2)  X86(eeepc)  Kernel space:  KFT  printk  rdtscll  User space: button pressed  ddms  Bootchart HW init/boot ROM Boot loader Kernel KFT, printk, rdtscll User space ddms,Bootchart, First avail use code instrumentation 15

16.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 •oprofile •dmesg with code instrumentation  Integration benefit  Reduce code optimization time  Quick detect system-wide performance issue  Integration issue  Time synchronization  Log centralization 16

17.Code Instrumentation  Daemon write by C program  include “cutils/log.h” LOGI(“my_log_message”);  Service/AP write by java  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

18. Bootchart 1:System prepare stage 4:HomeLoad(boot completed) 2:VM env prepare stage 3:load Android services/management stage Time sequence 18

19. Booting Procedure measurement  Base on Android Dev1 with Android 2.0 9sec 37.5sec 6 12 Service 1 Poweron Manager Services/Managers: 7 Power manager vold Activity manager Boot Telephony registry 2 ROM adbd Package manager rild 5 Account manager Debuggerd Boot .. Content manager 3 Loader init Hardware service 10 11 8 9 Power service System [Surface,Audio] Watchdog 4 Kernel Zygote Dalvik Server Flinger Sensor service Window manager Bluetooth .. 13 14 Dalvik(home) First available use 19

20. Booting Procedure dependence  Dependence(from init to home) Init adbd servicemanager rild zygote preload classes/resources systemserver PowerManager ActivityManager PowerManager Telephony registry PackageManager AccountManager ContentManager SystemContentManager BatteryService HardwareService SensorService WindowManager StatusBarService InputMethodService ConnectivityService AccessibilityManager NotificationManager LocationManager SearchService CheckinService WallpaperService AudioService AppWidgetService HomeLoader Boot done 20

21.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  Startpoint: “init process start”  End point: “HomeLoaders” Bootloader+kernel User space total Booting time 9.52sec 37.8sec 47.32sec ratio 21% 79% 100% 21

22.Booting Time Analysis(2/2) Android Booting Time hardware init + bootloader; 9% kernel ; 11% services/managements; 36% init/system prepare; 4% VM environment; 40% Need improve Next:Devide into loading and running 22

23.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( nee d study feasibility ) 23

24. References 1. Mattias, “The Android boot process from power on,” http://androidenea.blogspot.com/2009/06/android-boot-process-from-power-on.htm l , Jun 2009. 2. Walkingice, “How Android Differs from GNU/LINUX?,” http://walkingice.twbbs.org/~ walkingice/files/document/coscup_2009_walkingice.pdf , COSCUP, August 2009. 3. Patrick Brady, “Anatomy & Physiology of an Android,” http://sites.google.com/site/io/anatomy--physiology-of-an-android, 2008. 4. Wen-chang Chung, “The Study and Implement of Operating System Porting for An droid,” Master Thesis, National Taipei University of Technology, 2009. 5. Florian Strunk, Robert Baumgartl, ”An Analysis of Linux Boot Times,” Chemnitz Uni versity of Technology, Mar 2008. 6. Camellia Ghoroghi, Tannaz Alinaghi, “An introduction to profiling mechanisms and Linux profilers,” University of Tehran, Nov 2006. 7. Chih-Chien Yang, “An Empirical Analysis of Embedded Linux Kernel 2.6.14 to Achi eve Faster Boot Time,” Master Thesis, National Chiao-Tung University, 2006. 8. Chien-Ming Huang, “A Timing Analysis of Booting Procedures on Embedded Linux Systems,” Master Thesis, National Chiao-Tung University, 2006. 9. Cheng-Wei Li, “Construct A Fast-Boot Embedded System by Predefined Boot Ima ge,” CCL TECHNICAL JOURNAL, 2005. 10. Andy Pfiffer,” Reducing System Reboot Time With kexec,” Open Source Developm ent Labs, Inc, 2003. 11. Robert Bell,”ParaProf: A Protable, Extensible, and Scalable Tool for Parallel Perfor 24 mance Profile Analysis,” Springer-Verlag Berlin Heidelberg, 2003