- Improving app startup with I/O prefetching
- Iorap cmd compiler андроид
- Создание нативных Android-приложений с использованием компилятора Intel C++ Compiler в Android Studio 1.0.1
- Требуемые программные инструменты
- Использование компилятора Intel C++ Compiler в Android Studio 1.0.1
- 1. Создание нового проекта Android с нативным интерфейсом:
- 2. Добавление нативного исходного кода: main.c
- 3. Добавление make-файла: Android.mk
- 4. Добавление make-файла: Application.mk
- 5. Сконфигурируйте свое приложение для выполнения ndk-build с помощью make-файлов
- 6. Добавьте ID «hello_textview» в виджет textview
- 7. Обновите «MainActivity.java», чтобы UI textview вызов нативной библиотеки:
- 8. Запустите виртуальную машину Android Virtual Machine «Intel-Nexus 7 x64» и выполните приложение, щёлкнув кнопку «Run».
Improving app startup with I/O prefetching
In Android 11, we introduced IORap, a new feature which greatly improves application startup times. We have observed that apps start more than 5% faster (cold startup) on average across a variety of devices. Some hero cases show 20%+ faster startup times. Users get this additional performance without any developer app changes!
IORap prefetching for Android apps
IORap reduces app startup times by predicting which I/O will be required and doing it ahead of time. Many app startups have a lot of time that the IO request queue isn’t being saturated because of blocking I/O. As a result, we aren’t maximizing IO latency. After prefetching the data and compacting the I/O, the app can access this data nearly instantly from the pagecache , significantly reducing app startup latency.
When we evaluated some popular top apps from the Play Store, 80%+ spent 10%+ time in blocking I/O during launch time. while
50% of the apps even spent 20%+ time. A majority of apps we looked at could benefit from IORap.
IORap works as an independent service on the device. It interacts with package manager, activity manager, perfetto service, etc via IPC. The overall architecture of IORap is shown in the following figure:
Step 1: Collecting perfetto traces
IORap uses a profiling-based strategy to determine the I/O to be prefetched. The knowledge comes from perfetto trace, which records the kernel pagecache page removals/additions (from ftrace). In the first several cold-runs of an app, the perfetto tracing is on to get the pagecache missing events. Our study shows the overhead of perfetto tracing on startup time is neglectable.
Step 2: Generating prefetch list
Based on the perfetto traces obtained from the prior step, IORap generates a prefetch list during the idle time of the device. Basically, the prefetch list contains the information of the file (name, offset, length) that was accessed by an app when it’s launched. IORap analyzes the mm_pagemap events from the perfetto trace and converts its result ( inode , offset, length) to (name, offset, length) by reversing inode to filename. Data is then stored in the prefetch list, which is a protobuf file.
Step 3: I/O prefetching
After the prefetch list is generated, IORap can prefetch the corresponding data for the following runs of the app. The perfetto tracing is not needed any more. The user and developer don’t need to do anything. The prefetching is performed when the user taps on the icon or indirectly via another app requesting it via Intent. Enjoy the speedup!
Step 4: Obsoleting the prefetch list
The prefetch list doesn’t live forever. Several events may cause the prefetch list to become obsolete. When an app is updated, the prefetch list is deprecated because the app may change and the previous data may be inaccurate. Also, the dexopt service can optimize the app after installation. Once the app is optimized, the layout may differ making the prefetch list obsolete. The obsolete prefetch list will be removed and a new round will start with perfetto trace collections.
Collating results from several experiments in our lab we determined that IORap benefits cover the spectrum from low end to high end devices. On average, IORap could provide up to
26% speedup. It’s extremely helpful for apps that have heavy I/O during startup. For example, Spotify shows double digit improvement for both low-end devices (Go and Pixel 3A) and high end-devices (Pixel 3 or 4).
One interesting observation during the experiment is that the performance of IORap is largely impacted by the amount of prefetched data. An accurate trace duration is super important for IORap. A shorter trace duration causes less data than necessary to be prefetched and less performance gain. On the other hand, a longer one leads to more data than necessary being prefetched, which may result in slower startup in worst case scenarios. IORap uses the timestamp of when an app reports the ReportFullyDrawn event to estimate trace duration. For apps not reporting this event, the display time is used. So invoking the reportFullyDrawn callback at the right time can improve the performance of IORap.
We’re excited about the improvement that IORap has shown, and we plan to explore this concept more in the future in the following two directions. Firstly, prefetching more often. It would be great if prefetching could be done during profiling. Then we could eliminate some of the performance gap before generating the prefetching list by providing a prebuilt prefetching list. Secondly, IORap could predict that an app will start and begin prefetching earlier, further speeding up startup time.
You can help IORap out by invoking the ReportFullyDrawn callback when your app completes its startup. IORap mainly helps reduce the I/O blocking time, so consider profiling your app startup for other possible performance issues.
Источник
Iorap cmd compiler андроид
Этот материал не претендует на абсолютную истину, может быть, что-то можно сделать проще и быстрее. Автор как знает, так и делает. Кроме того он не является большим экспертом в области nix-систем. Всё, что написано ниже, найдено на просторах интернета, в большинстве своём на не русскоязычных форумах, систематизировано и изложено на родном для автора языке — русском.
Коллеги, не задавайте мне вопросы по данной теме в личку, уже несколько лет как я забросил Android и не интересуюсь развитием ядер, как впрочем и самого Android-a.
Сообщение отредактировал PaWill — 08.03.16, 14:54
Часть 1. Необходимые инструменты и исходники
Для компиляции ядра нам потребуется nix-подобная операционная система. Я использовал Ubuntu 10.04 LTS — Long-term support 32-bit, которую установил на виртуальную машину VMware Workstation. Где всё это добро скачать/купить, как установить мы здесь обсуждать не будем. Если вы это не смогли сделать самостоятельно или с помощью гугла, то читать эту статью для вас ещё рано (или уже поздно). 🙂
И так, у нас всё установлено и работает. Теперь проверим все ли необходимые компоненты присутствуют в системе, возможно какие то пакеты придётся доустановить.
Запускаем терминал: