CodeFest 2012. Лоенко М. — Разработка и оптимизация Android* приложений под платформы на базе Intel Atom
1. Разработка и оптимизация
Android* приложений для
платформ на основе процессоров
Intel® Atom™
Михаил Лоенко,
руководитель группы по разработке ПО, Intel
*Other names and brands may be claimed as the property of others.
3. Содержание
• Android* на платформах с Intel® Atom™
• Обзор приложений Android*
• Разработка приложений Android* с x86 NDK
• Оптимизация Android* приложений под Intel
Atom
• Полезные ресурсы для разработчиков под
Android*
• Заключение/Call to Action
3 Developing and Optimizing Android* Applications for Intel® Atom™ Processor-based Platforms
4. SoC платформа «Medfield» на основе
процессора Intel® Atom™
Пользовательский
32nm SoC функционал Отличная
скорость на ватт
Меньше Intel® Wireless Always On, Always
Display1 Connected2
Footprint‡ Богатый
функционал
Тонкий и лѐгкий с ошеломляюще
долгой работой аккумулятора, Multimedia
производительностью мультимедиа (1080p Encode,
2X Memory Dual Decode)
Bandwidth‡ Лучший в
Тонкий Лѐгкий
классе
<9 мм <680 г 3
Flash
Удобный для
пользователя
LPDDR2
Reference Design
позволяет оперативно выпускать с Intel на Android*
Обработка Встроенная
образов защита
4 Developing and Optimizing Android* Applications for Intel® Atom™ Processor-based Platforms
5. Типы приложений Android*
Приложения Android*
без «нативного» кода
• «Стандартные» приложения Dalvik*
Android* не зависят от optimized
Java* Classes
архитектуры CPU
Android*
• RenderScript*, Web Apps(WebView) Manifest
Resources
позволяют дополнительную гибкость
Приложения Android* с
«нативным» кодом
• Приложения Android* могут
включать нативный код Dalvik*
optimized
JNI/Native
code
(C/C++) при помощи Native Java* Classes libraries
Development Kit (NDK) Android*
Resources
Manifest
5 Developing and Optimizing Android* Applications for Intel® Atom™ Processor-based Platforms
6. Исполнение приложений Android* Apps на
устройствах с Atom
• Android* Market
• Существующие не-NDK приложения будут работать «как есть»
• NDK приложения потребуют перекомпиляции с NDK для x86 и
«переупаковки» с SDK
• Перенос приложений прост как банальная перекомпиляция
(если только приложение не «завязано» на конкретное
«железо»)
6 Developing and Optimizing Android* Applications for Intel® Atom™ Processor-based Platforms
7. Разработка приложений Android* для
Atom
• Android* Development Tools включают
поддержку x86
- Android* SDK, NDK и Eclipse* ADT plug-in
поддерживают x86
• Переиспользуйте существующие x86
приложения и библиотеки
- Они могут быть перенесены на Android* при помощи x86 NDK
- http://software.intel.com/en-us/android/
• Узнайте, как разрабатывать приложения под
Android*:
• http://developer.android.com/guide/developing/index.html
7 Developing and Optimizing Android* Applications for Intel® Atom™ Processor-based Platforms
8. Разработка приложений Android* с
нативным кодом под процессоры Atom
• Android* NDK работает совместно с Android SDK
и, начиная с r6, поддерживает x86
• http://software.intel.com/en-us/articles/ndk-for-ia/
• Разработчик может построить один APK, который
поддерживает все архитектуры, в т.ч. x86
– Android* Package Manager автоматически инсталлирует
правильную нативную библиотеку в момент инсталляции
• Воспользуйтесь преимуществами расширений
Atom Streaming SIMD!
- x86 ABI поддерживает расширения до SSE3 включительно
8 Developing and Optimizing Android* Applications for Intel® Atom™ Processor-based Platforms
9. Воспользуйтесь преимуществами
платформенного функционала, используя NDK
Разработка приложений с использованием Приложение Android* с
x86 NDK: «нативным» кодом
Dalvik* JNI/Native
• Постройте преимущества своего optimized
Java* Classes
code
libraries
приложения на основе функционала
платформы Atom SoC Android*
Resources
Manifest
• Задействуйте цифровые мультимедийные
устройства (напр., 60” телевизор) при
помощи технологии WiDi
Atom™ SoC Platform
• Получите дополнительные возможности
для обеспечения безопасности
• Насладитесь энергоэффективной Intel® Intel®
PC Instant
производительностью Wireless
Display
Wireless
Music
Sync* On
9 Developing and Optimizing Android* Applications for Intel® Atom™ Processor-based Platforms
10. Преимущества и недостатки
использования «нативного» кода
• Преимущества
• Задачи, чувствительные к производительности
• Преимущества прямого доступа к CPU/HW
• Новая жизнь уже написанного x86 софта
• Недостатки
• Переносимость
• Меньшая гибкость
10 Developing and Optimizing Android* Applications for Intel® Atom™ Processor-based Platforms
11. Инструменты Android*
• Android* SDK и AVD Manager,
DDMS, Traceview, итд – всѐ работает
• Создание AVD конфигурации для Atom’а с
использованием Android* SDK и AVD Manager’а
11 Developing and Optimizing Android* Applications for Intel® Atom™ Processor-based Platforms
12. Инструменты разработки Android* для
Atom
Android* x86 Emulator
• Доступен с SDK v12
http://software.intel.com/en-us/articles/installing-
the-android-sdk-for-ia/
• Полностью интегрирован в
Android* development
environment
http://software.intel.com/en-us/articles/android-ia-
emulator-gingerbread/
Android* x86 Emulator
12 Developing and Optimizing Android* Applications for Intel® Atom™ Processor-based Platforms
13. Платформенные инструменты Android*
• Используйте emulator-x86 с Intel VT HW acceleration
(опция –enable-kvm на linux)
• Использование ADB для присоединения к эмулятору x86 Android*
или к устройству
13
Developing and Optimizing Android* Applications for Intel® Atom™ Processor-based Platforms
14. Android Optimizations on Atom
Middleware Platform for Applications
Framework
• Javascript* and HTML5
optimizations Android* • Framework
Includes OEM/Carrier customization,
Intel® AtomTM processor optimized open
optimizations
• HW graphics
3rd-party components, support
source versions of Android
acceleration
Android* Runtime
Applications • Android* runtime
(Dalvik*) optimizations
Linux* Kernel App Framework • Trace-based JIT and
native code generation
• Expanded BSP w/ boot
Android* Runtime • Enriched memory
time and footprint
reduction Middleware management (e.g.,
garbage collection)
• Core OS optimization • JNI streamlining
BSP
Linux* Kernel • Runtime tuning
Platform Drivers &
Platform Drivers Optimized Power
Management
• Drivers optimized for Integrated & built as a
power & memory complete stack & made
footprint* From From From available publicly on a
Intel Google* OSV/SI web portal
14 Developing and Optimizing Android* Applications for Intel® Atom™ Processor-based Platforms
15. Приложения Android* Apps на Atom –
Рекомендации по улучшению быстродействия
Общие советы для Android* приложений
http://developer.android.com/guide/practices/design/performance.html
• Избегайте создания ненужных объектов или выделений памяти
• Избегайте использования get/set функций внутри класса.
Используйте поля напрямую.
• Используйте Static/Final где это уместно
• Не используйте floating point типы без необходимости
• Используйте стандартные библиотеки с готовыми
«оптимизациями»
• Проблемы производительности можно изолировать с
помощью Traceview* и DDMS инструментов
15 Developing and Optimizing Android* Applications for Intel® Atom™ Processor-based Platforms
16. Приложения Android* Apps на Atom –
Рекомендации по улучшению быстродействия
• Предварительное выделение памяти под объекты
– Частый garbage collection может повлечь существенные накладные
расходы
• Android для Atom содержит JIT
• Используйте «нативный» код (NDK) где
возможно/уместно
• Быстродействие != user experience
• Советы по дизайну приложений
• http://developer.android.com/guide/practices/design/seamlessness.html
• http://developer.android.com/guide/practices/design/responsiveness.html
16 Developing and Optimizing Android* Applications for Intel® Atom™ Processor-based Platforms
17. Отладка производительности Android*
приложений
• В поставку Android* SDK входят несколько
инструментов для отладки производительности
Android* приложений
• http://software.intel.com/en-us/articles/performance-debugging-of-android-
applications/
• DDMS
• Thread updates
• Heap Tools
• Allocation Tracker
• Traceview
• Method Profiling with DDMS
• Precise profiling using trace API
• Hierarchy Viewer and layoutopt
17 Developing and Optimizing Android* Applications for Intel® Atom™ Processor-based Platforms
18. Производительность UI в Android*
приложениях
• layoutopt
• Анализирует layout XML файлы и выдает отчет о неэффективном
использовании.
• Очень полезен для быстрой оптимизации views/layouts
приложения, уменьшения времени загрузки и т.д.
• Hierarchy Viewer
• Отображает временные затраты на Measure, Layout и Draw
• Используется для изоляции медленных участков UI
18 Developing and Optimizing Android* Applications for Intel® Atom™ Processor-based Platforms
19. Анализ производительности и энергопотребления
на уровне Android* системы
• Как и в Linux*, в Android* можно использовать те же
системные инструменты для нискоуровневого доступа к
параметрам системы
• Производительность: “top”, /proc/<pid>/stat, /proc/stat
• Энергопотребление: /sys/class/power_supply/battery/uevent
• P-states: /sys/devices/system/cpu/cpuX/cpufreq/stats
• Для анализа памяти, используемой конкретным процессом и
системой, можно использовать “procrank”
• procrank доступен только в инженерных образах системы.
• Ресурсы Intel для Android* разработчиков детально
охватывают данную тематику:
• http://software.intel.com/en-us/articles/android-power-measurement-techniques/
• http://software.intel.com/en-us/articles/performance-assessment-of-android-applications/
19 Developing and Optimizing Android* Applications for Intel® Atom™ Processor-based Platforms
20. Intel Developer Resources for Android*
• Getting Started
• Technical Content
• Online Community
• Opinion Blogs
• Support Forums
• Videos & Events
http://intel.com/software/android
20 Developing and Optimizing Android* Applications for Intel® Atom™ Processor-based Platforms
21. Заключение / Call for action
• Вы можете подготовить ваше приложение к
работе на Intel Atom уже сейчас.
– Используйте новейшую версию Android* SDK для проверки приложения
на x86 эмуляторе
– Обновите ваши Android* приложения для поддержики форм-фактора
планшета.
– Разработайте/спортируйте ваши NDK приложения с помощью новейшей
версии Google NDK
• Intel и ISV уже портируют/тестируют приложения
к выпуску устройств на Intel Atom.
• Оптимизируйте ваши приложения для
наилучшего результата при работе на Intel
Architecture
Зарегистрируйтесь на:
http://intel.com/software/android
21 Developing and Optimizing Android* Applications for Intel® Atom™ Processor-based Platforms
22. Risk Factors
The above statements and any others in this document that refer to plans and expectations for the second quarter, the year and the future 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 Intel’s actual results, and variances from Intel’s current
expectations regarding such factors could cause actual results to differ materially from those expressed in these forward-looking statements. Intel
presently considers the following to be the important factors that could cause actual results to differ materially from the company’s expectations. Demand
could be different from Intel's expectations due to factors including changes in business and economic conditions, including supply constraints and other
disruptions affecting customers; customer acceptance of Intel’s and competitors’ products; changes in customer order patterns including order
cancellations; and changes in the level of inventory at customers. Potential disruptions in the high technology supply chain resulting from the recent
disaster in Japan could cause customer demand to be different from Intel’s expectations. Intel operates in intensely competitive industries that are
characterized by a high percentage of costs that are fixed or difficult to reduce in the short term and product demand that is highly variable and difficult to
forecast. Revenue and the gross margin percentage are affected by the timing of Intel product introductions and the demand for and market acceptance of
Intel's products; actions taken by Intel's competitors, including product offerings and introductions, marketing programs and pricing pressures and Intel’s
response to such actions; and Intel’s ability to respond quickly to technological developments and to incorporate new features into its products. The gross
margin 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; the timing and execution of the manufacturing ramp and
associated costs; start-up costs; excess or obsolete inventory; changes in unit costs; 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. 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 of revenue and profits. The majority of Intel’s non-marketable equity investment portfolio balance is concentrated in companies in
the flash memory market segment, and declines in this market segment or changes in management’s plans with respect to Intel’s investments in this
market segment could result in significant impairment charges, impacting restructuring charges as well as gains/losses on equity investments and interest
and other. Intel's results could be affected by adverse economic, social, political and physical/infrastructure conditions in countries where Intel, its
customers or its suppliers operate, including military conflict and other security risks, natural disasters, infrastructure disruptions, health concerns and
fluctuations in currency exchange rates. Intel’s results could be affected by the timing of closing of acquisitions and divestitures. Intel's results could be
affected by adverse effects associated with product defects and errata (deviations from published specifications), and by litigation or regulatory matters
involving intellectual property, stockholder, consumer, antitrust and other issues, such as the litigation and regulatory matters described in Intel's SEC
reports. An unfavorable ruling could include monetary damages or an injunction prohibiting us from manufacturing or selling one or more products,
precluding particular business practices, impacting Intel’s ability to design its products, or requiring other remedies such as compulsory licensing of
intellectual property. A detailed discussion of these and other factors that could affect Intel’s results is included in Intel’s SEC filings, including the report on
Form 10-Q for the quarter ended April 2, 2011.
Rev.5/9/11
22 Developing and Optimizing Android* Applications for Intel® Atom™ Processor-based Platforms
23. 23 Developing and Optimizing Android* Applications for Intel®
Atom™ Processor-based Platforms
24. Backup
24 Developing and Optimizing Android* Applications for Intel® Atom™ Processor-based Platforms
25. Abstract
Developing and Optimizing Android* Applications for Intel®
Atom™ Processor-based Platforms
In this session you will learn about developing Android* applications for
Intel® Atom™ processor-based Tablets and Smartphones. Learn what is
required to get your Android* application up and running on Intel®
Architecture. This session will address:
• Developing killer apps using Intel Atom- based tablets and smartphones
• Porting native libraries using x86 NDK
• Tips and tricks for identifying and removing performance bottlenecks
• Identifying optimization opportunities to make your killer app runs best on Intel Atom based Tablets and
Smartphones
• Resources available to developers in developing apps on Intel Architecture
25 Developing and Optimizing Android* Applications for Intel® Atom™ Processor-based Platforms