dev optimize android

Upload: booksephirot

Post on 05-Apr-2018

221 views

Category:

Documents


0 download

TRANSCRIPT

  • 7/31/2019 Dev Optimize Android

    1/21

    Deve lop ing and Op t im izing And r o id *

    f or I n t e l

    At om Pr ocessor - basedMob i le Dev i ces

    TABS002

    Dawei Cheng, Communication Application Enabling Engineer, IntelYang Wang, Sr. Technical Consultant Engineer, Intel

    Ailin Yang, Technical Marketing Engineer, Intel

  • 7/31/2019 Dev Optimize Android

    2/21

    2

    Agenda

    Sect ion Aud ience Dev ice Focus

    Developing Apps for IntelArchitecture (IA)-based AndroidDevices

    AppDevelopers

    Smartphones& Tablets

    Board Support Package (BSP)for Android

    OEMs andODMs

    Tablets

    Android Optimizations for IA AppDevelopers,OEMs, ODMs

    Smartphones& Tablets

    Summary All All

    The PDF for this Session presentation is available from our TechnicalSession Catalog at the end of the day at: intel.com/go/idfsessionsBJ

  • 7/31/2019 Dev Optimize Android

    3/21

    3

    Andro id * NDK App l i ca t i on

    Da lv ik App l i ca t ion

    Tw o Types o f And r o id * App l i ca t i ons

    AndroidApp Class

    JavaSource

    Compilewith Javac

    Java NativeLibrary Class

    Java* NativeLibrary

    Compilewith Javac

    Create C headerwith Javah -jni

    Head FileC Source

    Code

    Compile andLink C Code

    DynamicLibrary

    ApplicationFile

    Makefile

  • 7/31/2019 Dev Optimize Android

    4/21

    4

    And r o id * Nat i ve Deve lopm en t K i t ( NDK)I n t r o d u c t i o n

    Build performance-critical portions

    of your apps in native codes

    Reuse existing native codes

    Intel Hardware AcceleratedExecution Manager

    Significantly enhances performance

    for a variety of Android* IAemulator functions

    Seehttp://software.intel.com/en-us/articles/intel-hardware-accelerated-execution-manager/

    Android developer community:

    http://software.intel.com/zh-cn/android/

    Visit the Android Developers Zone on the Intel Software Network for

    more information about developing Android apps for IA devices

    http://software.intel.com/en-us/articles/intel-hardware-accelerated-execution-manager/http://software.intel.com/en-us/articles/intel-hardware-accelerated-execution-manager/http://software.intel.com/en-us/articles/intel-hardware-accelerated-execution-manager/http://software.intel.com/en-us/articles/intel-hardware-accelerated-execution-manager/http://software.intel.com/en-us/articles/intel-hardware-accelerated-execution-manager/http://software.intel.com/en-us/articles/intel-hardware-accelerated-execution-manager/
  • 7/31/2019 Dev Optimize Android

    5/21

    5

    NDK App l i ca t ion Deve lopm ent an dPor t i ng fo r I A Dev ices

    CreateNativeCodes

    CreateMakeFile

    CompileNativeCodes

    Call itfromJava*

    DebugwithGDB

    Java ApplicationSDK API

    JNI

    Native Libs

    Java Framework

    Android* Applications

    NDK API

    C Framework

    i. Can run in x86 directlyii. Adjust UI resolution

    iii. Adjust memory allocationfor higher resolution

    i. Recompile native codesii. Recompile share libraryiii. Porting ARM* assembly codes

    Most Android applications are Java* codes only and can run on IA devices directly;

    only a small number of applications contain native codes and need porting.

    APP_ABI := x86

  • 7/31/2019 Dev Optimize Android

    6/21

    6

    Nat i v e Codes Deve lopm ent Cons ide ra t ion

    Memory alignment

    Force memory alignment

    .

    Porting NEON instructions (ARM*) to SSE instructions(Intel)

    Assembly: consider the architecture difference in big endian andlittle endian;

    Consider registers storage limits;

    NEON native C libs cant be reused in Intel Atom based platforms

    struct TestStruct{

    int mVar1;long long mVar2;int mVar3;

    };

    ARM

    x86

    -malign-double

    Narrow Q register

  • 7/31/2019 Dev Optimize Android

    7/217

    Genera l Per f o r m ance Opt im izing

    Performance tuning

    Use inline functionsinline int max(int a, int b) { return a > b ? a : b; }

    Use data type float instead of double

    Multithreaded program to make full use of Intel Hyper-ThreadingTechnology on Intel Atom processors

    More information : http://www.intel.com/content/www/us/en/architecture-and-

    technology/hyper-threading/hyper-threading-technology.html Make GCC build codes more effective

    Add platform specific compile arguments-march=atom

    Use specific instructions-msse4

    -mavx

    -maes

    More information: http://gcc.gnu.org/onlinedocs/gcc/i386-and-x86_002d64-Options.html

    http://www.intel.com/content/www/us/en/architecture-and-technology/hyper-threading/hyper-threading-technology.htmlhttp://www.intel.com/content/www/us/en/architecture-and-technology/hyper-threading/hyper-threading-technology.htmlhttp://gcc.gnu.org/onlinedocs/gcc/i386-and-x86_002d64-Options.htmlhttp://gcc.gnu.org/onlinedocs/gcc/i386-and-x86_002d64-Options.htmlhttp://gcc.gnu.org/onlinedocs/gcc/i386-and-x86_002d64-Options.htmlhttp://gcc.gnu.org/onlinedocs/gcc/i386-and-x86_002d64-Options.htmlhttp://www.intel.com/content/www/us/en/architecture-and-technology/hyper-threading/hyper-threading-technology.htmlhttp://www.intel.com/content/www/us/en/architecture-and-technology/hyper-threading/hyper-threading-technology.html
  • 7/31/2019 Dev Optimize Android

    8/218

    Sect i on Sum m ary

    The majority of Android* app just run on IA

    Native apps should be recompiled using the Android NDK Architecture (ARM*, IA) specific assembly instructions should be

    appropriately coded

    Make full use of IA features to improve your Android

    application performance

    Add platform specific compile switches to make GCC buildcodes more effective

  • 7/31/2019 Dev Optimize Android

    9/219

    Agenda

    Sect ion Aud ience Dev ice Focus

    Developing Apps for IntelArchitecture (IA) basedAndroid* Devices

    AppDevelopers

    Smartphones& Tablets

    Board Support Package (BSP)for Android

    OEMs andODMs

    Tablets

    Android Optimizations for IA AppDevelopers,OEMs, ODMs

    Smartphones& Tablets

    Summary All All

  • 7/31/2019 Dev Optimize Android

    10/2110

    Burst mode 10 full

    resolution (8 MP) photosper second

    Front and Rear-Facingcameras, LED Flash

    Color correction, red eyeremoval

    Video & image stabilization

    Take snapshots while

    recording video Auto white balance / focus /

    exposure

    Geo tagging support

    Single-Motion PanoramaMode

    Zero Shutter Lag Exposure

    Key BSP Feat u r es at a Glan ceAndro id * CTS / CDD Com p l i an t

    HW-accelerated graphics

    VP8 video decodeoptimizations

    HW-accelerated video decode

    H.264 1080p @ 30fps

    MPEG-4 Level L3, L5

    H.263 baseline L70

    WMV9 multi-level support

    VC1 1080p @ 30 fps HW-accelerated video encode

    H.264, MPEG-4, H.263

    HW-accelerated audio decode

    HE-AACv1, HE-AACv2, MP3,PCM/Wave

    HW-accelerated Flash / AIR

    Multimedia

    HDMI 1.3a

    Clone mode 2 channel LPCM audio @

    44.1kHz

    Hot Plug support

    Logo compliancy testing

    2nd Screen

    HW-assisted secure boot andfull disk encryption

    Netflix* DRM (Playready)

    Power and Energy Management

    Security / DRM / Power

    Accelerometer, Gyroscope

    Ambient Light

    Barometric pressure,Magnetometer, Temperature

    Sensors

    Bluetooth 2.1 + EDR, 6

    profiles WiFi

    WiFi Direct

    WEP; WPA/WPA2 PSK

    EAP-TLS, 802.1x Enterprise

    GPS (A-GPS & standalone)

    Connectivity

    Imaging

    Intels Board Support Packages include all IA optimizations;

    CDD-compliance reduces time-to-market for OEMs

  • 7/31/2019 Dev Optimize Android

    11/2111

    Agenda

    Sect ion Aud ience Dev ice Focus

    Developing Apps for IntelArchitecture (IA) basedAndroid* Devices

    AppDevelopers

    Smartphones& Tablets

    Board Support Package (BSP)for Android

    OEMs andODMs

    Tablets

    Android Optimizations for IA AppDevelopers,OEMs, ODMs

    Smartphones& Tablets

    Summary All All

  • 7/31/2019 Dev Optimize Android

    12/2112

    An d r o id * Op t i m i zat i o n s f o r I n t e lA t om Pr ocessor Based Pla t fo r m s

    Dalvik VM runtime optimizations

    x86 Trace-based JIT

    Native Code Generation

    Enhanced memory management

    (garbage collection) JNI streamlining

    Tuning of native libraries

    Bionic C optimizations

    Javascript & HTML5 optimization

    Linux kernel and drivers

    Power Management forAndroid

    OpenGL* ES 1.1/2.0 Driver

    HW Overlay

    HW Accelerated Mediadecode/encode

    Library to integrate w/Android & referenceimplementation (MIX)

    Standard SoC drivers,

    middleware and applicationsoptimized for power

    Pow er Reduc t ionPe r fo rm ance Tun ing

    Intel has a rich history optimizing Java for IA. Weve applied that

    knowledge to Dalvik Java with impressive results.

  • 7/31/2019 Dev Optimize Android

    13/2113

    I n t e l Ato m Pr ocessor Op t im iza t ions

    0

    1

    2

    3

    4

    5

    6

    7

    Trace JIT enabled

    Up t o 6 x I m p r o v e m e n t !

    Perform

    ance

    Source: Intel Software and Solutions Group

    1 Intel Z670 reference design with Honeycomb2 SSE = Streaming SIMD Testing on Intel Z2460 CDK with Gingerbread.

    0

    0.2

    0.4

    0.6

    0.8

    1

    1.2

    1.4

    1.6

    1.8

    Sign i f i can t im provem en ts i n bo th w eb (HTML5)a n d Ja v a* w o r k l o a ds d u e t o o p t i m i z at i o n s f or I n t e l

    SSE ins t r uc t ion s in Andr o id graph ics l i b rar ies .

    Perform

    an

    ce

    No Trace JIT1

    Dalv ik Run t im e Op t im izat ions And r o id * N at i ve Li b r a r y

    No SSE2 with SSE

    Linpack CaffeineMark*

    HTML5Slideshow

    HTML5Zoom

    HTML5Animation

    HTML5Fancy Show

    JetBoy*Stress

    AlbumSlideshow(SA)

  • 7/31/2019 Dev Optimize Android

    14/2114

    Agenda

    Sect ion Aud ience Dev ice Focus

    Developing Apps for IntelArchitecture (IA) basedAndroid* Devices

    AppDevelopers

    Smartphones& Tablets

    Board Support Package (BSP)for Android

    OEMs andODMs

    Tablets

    Android Optimizations for IA AppDevelopers,OEMs, ODMs

    Smartphones& Tablets

    Summary All All

    O f f t t t i t i i t i

  • 7/31/2019 Dev Optimize Android

    15/2115

    Ou r ef f o r t s st a r t i n g t o g a in r e co g n i t i o nf r o m t h e An d r o id * Co m m u n i t y

    Pr e - bu i l t I n t e l Atom I m ages

    And r o id * SD K m anager has x86em u lat i on im ages bu i l t - i n

    To em u la te an I n t e l A tom - basedAnd r o id phone, in s ta l l t h e I n t e l A tomx86 Sys tem I m age avai l ab le i n t heAndr o id SDK Manager

    http://software.intel.com/en-us/articles/installing-the-intel-

    atom-tm-android-x86-emulator-image-add-on-from-the-android-sdk-manager/

    Faster Em ula t ion I n t e l Hardw are Acce lera ted Execut ion

    Manager ( HAXM) fo r Mac and Window suses I n t e l Vi r tu a l i za t ion Techno logy

    ( I n t e l VT) t o acce le r a te x86 em u la t i onby an o r der o f m agn i t ude

    I n t e l VT i s a l r eady suppor ted in L inux*( K V M) f o r x 8 6

    http://software.intel.com/en-us/articles/intel-hardware-accelerated-execution-manager/

    Thanks to contributions to AOSP from Intel, the emulator now supportsrunning x86 system images in virtualization mode on Windows and Mac

    OSX. This allows the emulator running at near native speed.34,000 downloads in the first week!

    Highlighted by Google at

    Game Developer Conference1200 downloads in first week

  • 7/31/2019 Dev Optimize Android

    16/2116

    Intel Smartphones Coming to UK,France, China India

    February 27, 2012

    an d f r o m t h e p r ess

    http://www.tomshardware.com/news/Intel-Medfield-Phone-Santa-Clara-Benchmarks,14970.html
  • 7/31/2019 Dev Optimize Android

    17/2117

    S u m m a r y

    The majority of Android* apps just run on IntelArchitecture (IA)

    Intel board support packages for Android include thelatest IA optimizations and pass Android CTS,

    speeding time-to-market for device makers

    Intel has been optimizing Android for IA for manyyears with impressive results

  • 7/31/2019 Dev Optimize Android

    18/2118

    W h e r e t o g et m o r e i n f o

    I n t e l So f t w a r e N et w o r k ( I SN )

    Real developers sharing knowledge andoffering help

    Dedicated communities and forums

    focused on your interests Worldwide reach News and insights on cutting edge

    technology

    I n t e l And ro id Deve loper Webs i t e

    Great content you wont find anywhere else Technical articles, tools, and How-To guides Native app porting tips & case studies

    Info on x86 emulator and Intel HardwareAccelerated Execution Manager

    Active forums and blogs written by Intel andcommunity experts

    w w w .i n t el .co m / so f t w a r e / a n dr o id

  • 7/31/2019 Dev Optimize Android

    19/2119

    Legal D iscla im erINFORMATION IN THIS DOCUMENT IS PROVIDED IN CONNECTION WITH INTEL PRODUCTS. NO LICENSE, EXPRESS OR IMPLIED,BY ESTOPPEL OR OTHERWISE, TO ANY INTELLECTUAL PROPERTY RIGHTS IS GRANTED BY THIS DOCUMENT. EXCEPT ASPROVIDED IN INTEL'S TERMS AND CONDITIONS OF SALE FOR SUCH PRODUCTS, INTEL ASSUMES NO LIABILITY WHATSOEVERAND INTEL DISCLAIMS ANY EXPRESS OR IMPLIED WARRANTY, RELATING TO SALE AND/OR USE OF INTEL PRODUCTS INCLUDINGLIABILITY OR WARRANTIES RELATING TO FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABILITY, OR INFRINGEMENT OF ANY

    PATENT, COPYRIGHT OR OTHER INTELLECTUAL PROPERTY RIGHT. A "Mission Critical Application" is any application in which failure of the Intel Product could result, directly or indirectly, in

    personal injury or death. SHOULD YOU PURCHASE OR USE INTEL'S PRODUCTS FOR ANY SUCH MISSION CRITICALAPPLICATION, YOU SHALL INDEMNIFY AND HOLD INTEL AND ITS SUBSIDIARIES, SUBCONTRACTORS AND AFFILIATES, ANDTHE DIRECTORS, OFFICERS, AND EMPLOYEES OF EACH, HARMLESS AGAINST ALL CLAIMS COSTS, DAMAGES, AND EXPENSESAND REASONABLE ATTORNEYS' FEES ARISING OUT OF, DIRECTLY OR INDIRECTLY, ANY CLAIM OF PRODUCT LIABILITY,PERSONAL INJURY, OR DEATH ARISING IN ANY WAY OUT OF SUCH MISSION CRITICAL APPLICATION, WHETHER OR NOT INTELOR ITS SUBCONTRACTOR WAS NEGLIGENT IN THE DESIGN, MANUFACTURE, OR WARNING OF THE INTEL PRODUCT OR ANY OFITS PARTS.

    Intel may make changes to specifications and product descriptions at any time, without notice. Designers must not rely on the

    absence or characteristics of any features or instructions marked "reserved" or "undefined". Intel reserves these for futuredefinition and shall have no responsibility whatsoever for conflicts or incompatibilities arising from future changes to them. Theinformation here is subject to change without notice. Do not finalize a design with this information.

    The products described in this document may contain design defects or errors known as errata which may cause the product todeviate from published specifications. Current characterized errata are available on request.

    Intel processor numbers are not a measure of performance. Processor numbers differentiate features within each processorfamily, not across different processor families. Go to: http://www.intel.com/products/processor_number.

    Contact your local Intel sales office or your distributor to obtain the latest specifications and before placing your product order. Copies of documents which have an order number and are referenced in this document, or other Intel literature, may be

    obtained by calling 1-800-548-4725, or go to: http://www.intel.com/design/literature.htm

    Medfield and other code names featured are used internally within Intel to identify products that are in development and not yetpublicly announced for release. Customers, licensees and other third parties are not authorized by Intel to use code names inadvertising, promotion or marketing of any product or services and any such use of Intel's internal code names is at the solerisk of the user

    Intel, Bluetooth, Atom, VTune, and the Intel logo are trademarks of Intel Corporation in the United States and other countries.

    *Other names and brands may be claimed as the property of others. Copyright 2012 Intel Corporation.

    http://www.intel.com/design/literature.htmhttp://www.intel.com/design/literature.htm
  • 7/31/2019 Dev Optimize Android

    20/2120

    Legal D iscla im er

    Intel Hyper-Threading Technology (Intel HT Technology) is available on select Intel Coreprocessors. Requires an Intel HT Technology-enabled system. Consult your PC manufacturer. Performance willvary depending on the specific hardware and software used. For more information including details on which

    processors support Intel HT Technology, visit http://www.intel.com/info/hyperthreading .

    Performance tests and ratings are measured using specific computer systems and/or components and reflect theapproximate performance of Intel products as measured by those tests. Any difference in system hardware or softwaredesign or configuration may affect actual performance. Buyers should consult other sources of information to evaluatethe performance of systems or components they are considering purchasing. For more information on performance

    tests and on the performance of Intel products, reference www.intel.com/software/products.

    Opt im iza t ion No t i ce

    Intels compilers may or may not optimize to the same degree for non-Intel microprocessors for optimizations thatare not unique to Intel microprocessors. These optimizations include SSE2, SSE3, and SSSE3 instruction sets andother optimizations. Intel does not guarantee the availability, functionality, or effectiveness of any optimization onmicroprocessors not manufactured by Intel. Microprocessor-dependent optimizations in this product are intendedfor use with Intel microprocessors. Certain optimizations not specific to Intel microarchitecture are reserved for

    Intel microprocessors. Please refer to the applicable product User and Reference Guides for more informationregarding the specific instruction sets covered by this notice.Notice revision #20110804

    http://www.intel.com/info/hyperthreadinghttp://www.intel.com/software/productshttp://www.intel.com/software/productshttp://www.intel.com/info/hyperthreading
  • 7/31/2019 Dev Optimize Android

    21/21

    Risk Fact or sThe above statements and any others in this document that refer to plans and expectations for the first quarter, the year and thefuture are forward-looking statements that involve a number of risks and uncertainties. Words such as anticipates, expects,intends, plans, believes, seeks, estimates, may, will, should and their variations identify forward-looking statements.Statements that refer to or are based on projections, uncertain events or assumptions also identify forward-looking statements.Many factors could affect Intels actual results, and variances from Intels current expectations regarding such factors could causeactual results to differ materially from those expressed in these forward-looking statements. Intel presently considers the followingto be the important factors that could cause actual results to differ materially from the companys expectations. Demand could bedifferent from Intel's expectations due to factors including changes in business and economic conditions, including supplyconstraints and other disruptions affecting customers; customer acceptance of Intels and competitors products; changes incustomer order patterns including order cancellations; and changes in the level of inventory at customers. Uncertainty in globaleconomic and financial conditions poses a risk that consumers and businesses may defer purchases in response to negativefinancial events, which could negatively affect product demand and other related matters. Intel operates in intensely competitiveindustries that are characterized by a high percentage of costs that are fixed or difficult to reduce in the short term and productdemand that is highly variable and difficult to forecast. Revenue and the gross margin percentage are affected by the timing of Intelproduct introductions and the demand for and market acceptance of Intel's products; actions taken by Intel's competitors, includingproduct offerings and introductions, marketing programs and pricing pressures and Intels response to such actions; and Intelsability to respond quickly to technological developments and to incorporate new features into its products. Intel is in the process oftransitioning to its next generation of products on 22nm process technology, and there could be execution and timing issues

    associated with these changes, including products defects and errata and lower than anticipated manufacturing yields. The grossmargin percentage could vary significantly from expectations based on capacity utilization; variations in inventory valuation,including variations related to the timing of qualifying products for sale; changes in revenue levels; product mix and pricing; thetiming and execution of the manufacturing ramp and associated costs; start-up costs; excess or obsolete inventory; changes in unitcosts; defects or disruptions in the supply of materials or resources; product manufacturing quality/yields; and impairments of long-lived assets, including manufacturing, assembly/test and intangible assets. The majority of Intels non-marketable equityinvestment portfolio balance is concentrated in companies in the flash memory market segment, and declines in this marketsegment or changes in managements plans with respect to Intels investments in this market segment could result in significantimpairment charges, impacting restructuring charges as well as gains/losses on equity investments and interest and other. Intel'sresults could be affected by adverse economic, social, political and physical/infrastructure conditions in countries where Intel, itscustomers or its suppliers operate, including military conflict and other security risks, natural disasters, infrastructure disruptions,health concerns and fluctuations in currency exchange rates. Expenses, particularly certain marketing and compensation expenses,as well as restructuring and asset impairment charges, vary depending on the level of demand for Intel's products and the level ofrevenue and profits. Intels results could be affected by the timing of closing of acquisitions and divestitures. Intel's results could beaffected by adverse effects associated with product defects and errata (deviations from published specifications), and by litigation orregulatory matters involving intellectual property, stockholder, consumer, antitrust and other issues, such as the litigation andregulatory matters described in Intel's SEC reports. An unfavorable ruling could include monetary damages or an injunctionprohibiting us from manufacturing or selling one or more products, precluding particular business practices, impacting Intels abilityto design its products, or requiring other remedies such as compulsory licensing of intellectual property. A detailed discussion ofthese and other factors that could affect Intels results is included in Intels SEC filings, including the report on Form 10-Q for thequarter ended Oct. 1, 2011.

    Rev. 1/19/12