development to deployment : how tools from intel® help in building, profiling and debugging native...

45
Development to Deployment : How tools from Intel® help in Building, Profiling and Debugging Native and Java Android applications Gayathri Murali – Developer Evangelist, Intel® Corporation AnDevCon San Francisco – November 2014

Upload: intel-software

Post on 16-Jul-2015

393 views

Category:

Software


5 download

TRANSCRIPT

Development to Deployment : How tools from Intel® help in Building, Profiling and Debugging Native and Java Android applications

Gayathri Murali – Developer Evangelist, Intel® CorporationAnDevCon San Francisco – November 2014

Agenda

• Intel and Android

• Android Run Time and 64 bit

• NDK Application compatibility

• Tools

Intel® and Android

What is Intel working on for Android*?

Key AOSP and Kernel

Contributor

Optimized Drivers and Firmware

Highly Tuned Runtimes

Porting and Optimizing

Browser and Apps

NDK Apps Bridging

Technology64-Bit

64bit

Android* on x86 – What’s new?

• Intel 64-bit image added to Android SDK

• HAXM accelerated 64-bit Emulator

• #1 External contributor to Android

• #1 External contributor to Chrome

• 2009: android-x86.org (community driven)

• 2010: Google TVs

• 2011: AOSP

• 2012: First consumer devices

Android* devices with Intel®

Inside(Partial list)

Motorola*

RAZR i

ZTE*

Grand X

IN

Lava* Xolo

X900Megafon*

Mint

Lenovo*

K800

Orange* San

Diego

2012, 2013…

Lenovo* K900ASUS Fonepad™ Note FHD -

6”ZTE* Geek

2014… Asus* Zenfones 4/5/6 ASUS* Transformer

Pad TF103CG/303CL

Dell* Venue 8 7000

Intel® YoloAcer* Liquid C1

Etisalat E20*

ASUS* MeMO

Pad FHD 10ASUS* Fonepad™ 7”

Dell* Venue 7/8

KD Interactive

Kurio Tablet Toshiba

Excite GoAcer* Iconia Tab 8/One 8

MinnowBoard MAX

Intel NUCLenovo* S8Asus* MemoPad 7/8

Asus* FonePad 7/8

Samsung* Galaxy™ Tab 3

10.1”

These devices are all fully compatible

with the Android* ARM* ecosystem

Android* SDK apps

• These will directly work. We’re optimizing the

Runtimes for Intel® platforms.

Android* NDK apps

• Most will run without any recompilation on consumer platforms.

• Android NDK provides an x86 toolchain since 2011

• A simple recompile using the Android NDK yields the best

performance

• If there is specific processor dependent code, porting may be

necessary

Android Runtime

Core

Libraries

DVM / ART

Android Runtime (ART) and 64-bit Android

What is ART?

• ART is for “Android Runtime”

• Introduced experimentally in Android KitKat (available in

developer settings)

• Will completely replace “Dalvik” in Android L

• Dalvik is a Just In Time (JIT) Compilation based engine

while ART is Ahead Of Time (AOT) runtime engine

• Dalvik/ART are what “runs” Android system and user

applications

Dalvik vs ART

Dalvik ART

• JIT compilation • AOT compilation

• Increased CPU usage due to

JIT

• Improved battery life

• Lags in applications due to

garbage collector pauses

and JIT

• Reduced application lags

and better user experience

• Lower memory footprint due

to JIT

• Higher memory footprint due

to AOT

• Apps install times lower than

ART as compilation is

performed later

• Increased apps install times

as compilation is done during

install

• Improved developer tools

• Improved garbage collector

11

Dalvik VM vs. ART VM

Libdvm.so

Runtime support

Memory management

Interpreters

JIT compiler

dexopt

ODEX

DEX

Libart.so

Runtime support

Memory management

Interpreter

Class Linking

dex2oat

DEX

OAT

Libart-compiler.so

Quick Code Generator

Dalvik VM32-bit only

ART VM32-bit and 64-bit

DEX bytecode Native binary

Ahead Of

Time

Runtime

Just in

Time

Intel’s 64-bit contribution

• Intel is enabling the NDK to support

x86_64 builds

• Contribution to Chromium 64 bit

• Tools will be 64-bit ready when Google

releases 64-bit Android

• 64-bit x64 emulator image and

haxm driver

• Intel® System Studio 2015 is

Android* 64-bit ready

• Intel® INDE will also be Android*

64-bit ready

Intel is ready to enable the ecosystem once L-dessert is broadly available.

Improving compatibility of apps that uses the Android* NDK

If you have the source code of your native libraries, you can compile it

for several CPU architectures by setting APP_ABI to all in the Makefile

“jni/Application.mk”:

APP_ABI=all

The NDK will generate optimized code for all target ABIs

You can also pass APP_ABI variable directly to ndk-build,

and specify each ABI:

ndk-build APP_ABI=x86

Configuring NDK Target ABIs

ARM v7a libs are built

ARM v5 libs are built

x86 libs are built

mips libs are built

Put APP_ABI=all inside

Application.mk

Run ndk-build…

“Fat” APKs

By default, an APK contains libraries for every

supported ABIs.

Install lib/armeabi

libraries

Install lib/armeabi-

v7a libs

Install lib/x86

libraries

libs/armeabi-v7a

libs/x86

libs/armeabi

APK file

Libs for the selected ABI are installed, the others remain inside the downloaded APK.

Multiple APKs

Google Play* supports multiple APKs for the same application.

What compatible APK will be chosen for a device entirely depends on the android:VersionCode

If you have multiple APKs for multiple ABIs, best is to simply prefix your current version code with a digit representing the ABI:

2310 6310

You can have more options for multiple APKs, here is a convention that will work if you’re using all of these:

x86ARMv7

Uploading Multiple APKs to the store

Switch to Advanced mode before

uploading the second APK.

Demo – Android Studio and NDK

Intel® Tools for Android* app developersIntel® HAXM, INDE, System Studio, XDK…

Most of our tools are relevant even if you’re not targeting x86 platforms!

Tools

Intel® HTML5 Development Environment

(Intel® XDK)

• Great tools for free

• A convenient, cloud-based build tool that lets you target all

popular platforms and app stores

• Write once, run anywhere; code once, debug once, publish

everywhere

html5dev-software.intel.com

Cross-platform meets native

performanceIntel® INDE 2015

Cross-OS,

Cross-

Architecture

More

Performance,

Less Time

IDE Choice

C++/Java* tools and libraries for

Android* and Windows*

development, supporting ARM*

and Intel® architecture.

Code native applications, expose

underlying architecture, and

deliver higher performance,

responsive apps.

Freedom to integrate into your

preferred IDE: Visual Studio*,

Eclipse*,, or Android Studio*.

Download:

software.intel.com/intel-inde

Intel® Integrated Native Developer Experience (Intel® INDE) is a suite of tools that let you write fast

C++ code that targets multiple operating systems and multiple architectures, and speeds your time to

market.

Developer Needs

22

Integrated suite of tools for X-OS

and X-Arch development

Deploy on Multiple Device

Operating Systems and

Architectures

Develop Native Apps

on Preferred Host OSs

and IDEsUtilize Consistent Tools and Libraries

on Intel® Architecture and ARM*

Set Up Build Analyze Debug

Improve productivity at every step along the development chain

23

Seamless install process that

integrates into your IDE

Clean installation into your IDE and workflow

Pick your development

environment

24

Pick the tools you like to Install

Integrate with existing environment

27

Intel® INDE – Media for Mobile

iOS* Android* WinRT*

Build

Why do developers like to record

their video games?

• Let gamers to share their videos with friends on social

networks

• Make a video demonstrations for reviews, stores

• Share hints and walkthroughs

Video capturing using Android Media

Framework• Create and configure MediaCodec, initialize video format

• Create and configure MediaCodec input surface

• Create wrapper to manage OpenGL context for surface

• Create and configure MediaMuxer

• Initialize and capturing pipeline in a thread

• In a loop

• Capture frame to MediaCodec surface

• Encode frame to a buffer

• Pass buffer to MediaMuxer, write each frame

• Release all allocated recources

Video capturing with Media for Mobile

• Setup video format, output file name

• Initialize GLCapture

• Call start(), stop() to begin, finish capturing process

• Capture each frame inside a render loop by calling

beginCaptureFrame(), endCaptureFrame()

CompilingPerformance. Compatibility. Support.

Bring a heritage of Intel performance to your Android* and Windows*

apps using the Intel® C++ compiler

Performance for compute-intensive integer applications.

Compatible with GNU C++ in the Android* NDK for multi-

architecture support

Debug your applications for Windows and Android directly from

Visual Studio*

31

Build

Context Sensing SDKCreate compelling cross-platform context-aware experiences

Context sensing empowers mobile app developers to create

compelling cross-platform, context-aware experiences.

Understand the context of any action or event: build into your app or

experience the ability to know your users, their activity maps, their

preferences and behavior.

Rapid cross-platform development (Win*/Android*)

Algorithms that simplify sensor understanding

Insight thru proprietary Intel access to sensors

Store your data in the Intel® cloud, query at will

32

Build

CompilingPerformance. Compatibility. Support.

Bring a heritage of Intel performance to your Android* and Windows*

apps using the Intel® C++ compiler

Performance for compute-intensive integer applications.

Compatible with GNU C++ in the Android* NDK for multi-

architecture support

Debug your applications for Windows and Android directly from

Visual Studio*

33

Build

Intel® Integrated Performance

PrimitivesLow-level performance optimizations made accessible

A consistent API to accelerate your compute-intensive tasks regardless

of IA platform or operating system.

Automatically selects the best code path based on the accelerations

available in the CPU

Performance advantages for image processing, computer vision,

cryptography, and data compression workloads

The same APIs support Windows*, Android*, and OS X*

34

Analyze & Debug

Intel® Threading Building BlocksAward-winning library for task parallelism

Rich set of components to efficiently implement higher-level, task-

based parallelism using Intel Threading Building Blocks.

Pre-tested algorithms and features

Efficiently thread C++ mobile applications for performance

Parallelism helps to reduce power consumption and increase

responsiveness

35

Analyze & Debug

Graphics Frame AnalysisFrame performance analysis and exploration

Deep-dive into frame capture performance analysis and

experimentation for your OpenGL ES* and DirectX* 3D workloads.

DirectX 9/10/11.0 (Ivy Bridge and later)

OpenGL ES *1.X/2.X/3.0 (Baytrail)

36

Analyze & Debug

Graphics Frame DebuggingIn-depth frame capture and exploration

Debug and experiment with static frame captures from your OpenGL

ES* 3D workloads, explore frame construction, assets, state, and

more.

Supports OpenGL ES 1.X/2.X/3.0 workloads on Intel® Atom™

based and a selection of third-party ARM*-based Android* devices

37

Analyze & Debug

Platform AnalysisCPU/GPU work queues and trace exploration

Analyze trace captures from your OpenGL ES* and DirectX* 3D

workloads including CPU and GPU queued tasks, CPU and GPU

metrics, task durations, and more.

OpenGL ES 1.X/2.X/3.0 3D workloads on (Atom™-based Android*

devices)

DirectX 9/10/11.0 (Ivy Bridge and later)

38

Analyze & Debug

System AnalysisLive platform and app CPU/GPU metric analysis

Graph platform, CPU, and GPU metrics and experiment with a variety

of graphics overrides for your OpenGL* & DirectX* 3D workloads in

real time.

OpenGL ES 1.X/2.X/3.0 3D workloads on Intel® Atom™-based

Android* devices

DirectX 9/10/11.0 (Ivy Bridge and later)

39

Analyze & Debug

Intel® INDE: Product Summary

40

Intel® INDE: Feature DetailsI FEATURE

STARTER

EDITION: FREE

PROFESSIONAL

EDITION: $299

ULTIMATE

EDITION: $799

GETTING

STARTEDIDE Integration for Android* X X X

BUILD

Context Sensing SDK X X X

OpenCLTM Code Builder X X X

Media RAW Accelerator for

Windows*X X X

Media for Mobile X X X

Media SDK for Windows* X X X

Audio for Windows* X X

Intel® Threading Building

BlocksX

Intel® Integrated Performance

PrimitivesX

Intel® C++ Compilers X

ANALYZE/DEB

UG

Intel® HAXM X X X

System Analyzer X X X

Graphics Frame Analyzer X X X

Graphics Frame Debugger X X

Platform Analyzer X X

Debugger Extension for vs-

Android*X X

41

http://www.projectanarchy.com/

Project Anarchy*• Complete mobile game engine that includes Havok

Vision Engine, Physics, Animation Studio and AI

• Free to publish on Android (ARM and x86), iOS, and Tizen

• C++ development environment

• Efficient asset management system

• LUA scripting and debugging

• Extensible source code and full library of sample materials

• Remote debugging

• File serving for live asset updates

• Remote input

• Visual debugger

3rd party libraries x86 supportGame engines/libraries with x86 support:

• Havok Anarchy SDK: android x86 target available

• Unity

• Unreal Engine 3: android x86 target available

• Marmalade: android x86 target available

• Cocos2Dx: set APP_ABI in Application.mk

• FMOD: x86 lib already included, set ABIs in

Application.mk

• AppGameKit: x86 lib included, set ABIs in

Application.mk

• libgdx: x86 supported by default in latest releases

• AppPortable: x86 support now available

• Adobe Air: x86 support with latest SDK

Summary

• Continued contribution to Android ecosystem and

community

• ART and 64-bit support

• NDK apps can easily be ported to support x86 platforms

and in most cases work as is

• Great tools to support development to deployment

Q&A