aboutsummaryrefslogtreecommitdiff
path: root/en/devices/tech/dalvik
diff options
context:
space:
mode:
Diffstat (limited to 'en/devices/tech/dalvik')
-rw-r--r--en/devices/tech/dalvik/configure.html125
-rw-r--r--en/devices/tech/dalvik/dex-format.html8
-rw-r--r--en/devices/tech/dalvik/gc-debug.html49
-rw-r--r--en/devices/tech/dalvik/jit-compiler.html85
4 files changed, 169 insertions, 98 deletions
diff --git a/en/devices/tech/dalvik/configure.html b/en/devices/tech/dalvik/configure.html
index 79d61fdf..2018b9c5 100644
--- a/en/devices/tech/dalvik/configure.html
+++ b/en/devices/tech/dalvik/configure.html
@@ -104,7 +104,7 @@ enabled to work.</p>
<p>Example usage (in product’s BoardConfig.mk):</p>
-<pre><code>WITH_DEXPREOPT := true</code></pre>
+<pre class="devsite-click-to-copy">WITH_DEXPREOPT := true</pre>
<h3 id=dont_dexpreopt_prebuilts>DONT_DEXPREOPT_PREBUILTS</h3>
@@ -116,8 +116,10 @@ to first boot time.</p>
<p>Example usage (in product’s BoardConfig.mk):</p>
-<pre><code>WITH_DEXPREOPT := true
-DONT_DEXPREOPT_PREBUILTS := true</code></pre>
+<pre class="devsite-click-to-copy">
+WITH_DEXPREOPT := true
+DONT_DEXPREOPT_PREBUILTS := true
+</pre>
<h3 id=with_dexpreopt_boot_img_only>WITH_DEXPREOPT_BOOT_IMG_ONLY</h3>
@@ -130,8 +132,10 @@ selectively disable app pre-optimization via
<p>Example usage (in product’s BoardConfig.mk):</p>
-<pre><code>WITH_DEXPREOPT := true
-WITH_DEXPREOPT_BOOT_IMG_ONLY := true</code></pre>
+<pre class="devsite-click-to-copy">
+WITH_DEXPREOPT := true
+WITH_DEXPREOPT_BOOT_IMG_ONLY := true
+</pre>
<h3 id=local_dex_preopt>LOCAL_DEX_PREOPT</h3>
@@ -152,7 +156,9 @@ APK signatures to remain valid.</p>
<p>Example usage (in app’s Android.mk):</p>
-<pre><code>LOCAL_DEX_PREOPT := false</code></pre>
+<pre class="devsite-click-to-copy">
+LOCAL_DEX_PREOPT := false
+</pre>
<h3 id=product_dex_preopt_*>PRODUCT_DEX_PREOPT_*</h3>
@@ -177,8 +183,10 @@ maximally used to improve first boot time.</p>
<p>Example usage (in product’s device.mk):</p>
-<pre><code>PRODUCT_DEX_PREOPT_DEFAULT_FLAGS := --compiler-filter=interpret-only
-$(call add-product-dex-preopt-module-config,services,--compiler-filter=space)</code></pre>
+<pre class="devsite-click-to-copy">
+PRODUCT_DEX_PREOPT_DEFAULT_FLAGS := --compiler-filter=interpret-only
+$(call add-product-dex-preopt-module-config,services,--compiler-filter=space)
+</pre>
<p>These flags can also be used to selectively disable pre-optimization of a
particular module or package by specifying <code>$(call
@@ -187,7 +195,9 @@ product's device.mk file.</p>
<p>Example usage (in product’s device.mk):</p>
-<pre><code>$(call add-product-dex-preopt-module-config,Calculator,disable)</code></pre>
+<pre class="devsite-click-to-copy">
+$(call add-product-dex-preopt-module-config,Calculator,disable)
+</pre>
<h2 id=other_odex>First boot installation of DEX_PREOPT files</h2>
@@ -199,14 +209,17 @@ partition. They are then copied to the data partition on first boot.</p>
<p>Example usage (in device-common.mk):</p>
-<pre><code>PRODUCT_PACKAGES += \
+<pre class="devsite-click-to-copy">
+PRODUCT_PACKAGES += \
cppreopts.sh
PRODUCT_PROPERTY_OVERRIDES += \
ro.cp_system_other_odex=1
-</code></pre>
+</pre>
<p>And in device's BoardConfig.mk:</p>
-<pre><code>BOARD_USES_SYSTEM_OTHER_ODEX := true</code></pre>
+<pre class="devsite-click-to-copy">
+BOARD_USES_SYSTEM_OTHER_ODEX := true
+</pre>
<p>See <a href="/devices/tech/ota/ab_updates.html#compilation">App
compilation in background</a> to optionally include the compilation script and
@@ -226,7 +239,9 @@ have to have its own copy, again wasting memory.</p>
<p>Example usage (in product’s device.mk):</p>
-<pre><code>PRODUCT_COPY_FILES += &lt;filename&gt;:system/etc/preloaded-classes</code></pre>
+<pre class="devsite-click-to-copy">
+PRODUCT_COPY_FILES += &lt;filename&gt;:system/etc/preloaded-classes
+</pre>
<p class="note"><strong>Note:</strong> This line must be placed before
inheriting any product configuration makefiles that get the default one from
@@ -246,7 +261,9 @@ post-L in AOSP, a custom image classes list can be specified using
<p>Example usage (in product’s device.mk):</p>
-<pre><code>PRODUCT_DEX_PREOPT_BOOT_FLAGS += --image-classes=&lt;filename&gt;</code></pre>
+<pre class="devsite-click-to-copy">
+PRODUCT_DEX_PREOPT_BOOT_FLAGS += --image-classes=&lt;filename&gt;
+</pre>
<h2 id=compiled_classes_list>Compiled Classes List</h2>
@@ -262,7 +279,9 @@ also be specified using <code>PRODUCT_DEX_PREOPT_BOOT_FLAGS</code>.</p>
<p>Example usage (in product’s device.mk):</p>
-<pre><code>PRODUCT_COPY_FILES += &lt;filename&gt;:system/etc/compiled-classes</code></pre>
+<pre class="devsite-click-to-copy">
+PRODUCT_COPY_FILES += &lt;filename&gt;:system/etc/compiled-classes
+</pre>
<p class="note"><strong>Note:</strong> This line must be placed before
inheriting any product configuration makefiles that get the default one from
@@ -280,9 +299,13 @@ methods that are too large to be represented by the compiler’s internal
representation.
<li><em>speed</em> - compiles most methods and maximizes runtime performance, which is the
default option.
+ <li><em>speed-profile</em> - compiles methods passed from a profile file
+ through the <em>--profile-file</em> option or <em>--profile-file-fd</em> option.
<li><em>balanced</em> - attempts to get the best performance return on compilation investment.
<li><em>space</em> - compiles a limited number of methods, prioritizing storage space.
<li><em>interpret-only</em> - skips all compilation and relies on the interpreter to run code.
+ <li><em>verify-profile</em> - skips all compilation and only performs verification of methods passed
+ from a profile file through the <em>--profile-file</em> option or <em>--profile-file-fd</em> option.
<li><em>verify-none</em> - special option that skips verification and compilation, should be used only
for trusted system code.
</ul>
@@ -299,8 +322,10 @@ should enable PIC compilation.</p>
<p>Example usage (in product’s device.mk):</p>
-<pre><code>WITH_DEXPREOPT := true
-WITH_DEXPREOPT_PIC := true</code></pre>
+<pre class="devsite-click-to-copy">
+WITH_DEXPREOPT := true
+WITH_DEXPREOPT_PIC := true
+</pre>
<p>Starting in Android 7.0, PIC compilation is enabled by default.</p>
@@ -316,14 +341,18 @@ regressions may appear in benchmarking.</p>
<p>Example usage (in product’s device.mk):</p>
-<pre><code>WITH_ART_SMALL_MODE := true</code></pre>
+<pre class="devsite-click-to-copy">
+WITH_ART_SMALL_MODE := true
+</pre>
<p>In future releases, this build option will be removed since it can be done with
this (in product’s device.mk):</p>
-<pre><code>PRODUCT_PROPERTY_OVERRIDES += \
+<pre class="devsite-click-to-copy">
+PRODUCT_PROPERTY_OVERRIDES += \
dalvik.vm.dex2oat-filter=interpret-only \
- dalvik.vm.image-dex2oat-filter=speed</code></pre>
+ dalvik.vm.image-dex2oat-filter=speed
+</pre>
<h2 id=dalvik_vm_properties>dalvik.vm Properties</h2>
@@ -383,23 +412,29 @@ all that is necessary.
<p>BoardConfig.mk:</p>
-<pre><code>WITH_DEXPREOPT := true</code></pre>
+<pre class="devsite-click-to-copy">
+WITH_DEXPREOPT := true
+</pre>
<p>If this causes the system image to become too large, the next thing to try is
disabling pre-optimization of the prebuilts.
<p>BoardConfig.mk:</p>
-<pre><code>WITH_DEXPREOPT := true
-DONT_DEXPREOPT_PREBUILTS := true</code></pre>
+<pre class="devsite-click-to-copy">
+WITH_DEXPREOPT := true
+DONT_DEXPREOPT_PREBUILTS := true
+</pre>
<p>Again, if the system image is still too large, try pre-optimizing only the boot
image.
<p>BoardConfig.mk:</p>
-<pre><code>WITH_DEXPREOPT := true
-WITH_DEXPREOPT_BOOT_IMG_ONLY := true</code></pre>
+<pre class="devsite-click-to-copy">
+WITH_DEXPREOPT := true
+WITH_DEXPREOPT_BOOT_IMG_ONLY := true
+</pre>
<p>However, limiting to pre-optimizing only the boot-image means all apps will
have to be optimized on first boot. In order to avoid this, it is possible to
@@ -413,12 +448,16 @@ potentially interpreting more code and impacting runtime performance.
<p>BoardConfig.mk:</p>
-<pre><code>WITH_DEXPREOPT := true
-DONT_DEXPREOPT_PREBUILTS := true</code></pre>
+<pre class="devsite-click-to-copy">
+WITH_DEXPREOPT := true
+DONT_DEXPREOPT_PREBUILTS := true
+</pre>
<p>device.mk:</p>
-<pre><code>PRODUCT_DEX_PREOPT_BOOT_FLAGS := --compiler-filter=space</code></pre>
+<pre class="devsite-click-to-copy">
+PRODUCT_DEX_PREOPT_BOOT_FLAGS := --compiler-filter=space
+</pre>
<p>If a device has very limited system partition space, it’s possible to compile a
subset of classes in the boot classpath using the compiled classes list. Boot
@@ -427,12 +466,16 @@ could affect runtime performance.
<p>BoardConfig.mk:</p>
-<pre><code>WITH_DEXPREOPT := true
-WITH_DEXPREOPT_BOOT_IMG_ONLY := true</code></pre>
+<pre class="devsite-click-to-copy">
+WITH_DEXPREOPT := true
+WITH_DEXPREOPT_BOOT_IMG_ONLY := true
+</pre>
<p>device.mk:</p>
-<pre><code>PRODUCT_COPY_FILES += &lt;filename&gt;:system/etc/compiled-classes</code></pre>
+<pre class="devsite-click-to-copy">
+PRODUCT_COPY_FILES += &lt;filename&gt;:system/etc/compiled-classes
+</pre>
<p>If a device has both limited space in the system and data partitions, compiler
filter flags can be used to disable compilation of certain apps. This will save
@@ -446,13 +489,17 @@ speed.
<p>BoardConfig.mk:</p>
-<pre><code>WITH_DEXPREOPT := true
-DONT_DEXPREOPT_PREBUILTS := true</code></pre>
+<pre class="devsite-click-to-copy">
+WITH_DEXPREOPT := true
+DONT_DEXPREOPT_PREBUILTS := true
+</pre>
<p>device.mk:</p>
-<pre><code>PRODUCT_DEX_PREOPT_DEFAULT_FLAGS := --compiler-filter=interpret-only
-$(call add-product-dex-preopt-module-config,services,--compiler-filter=space)</code></pre>
+<pre class="devsite-click-to-copy">
+PRODUCT_DEX_PREOPT_DEFAULT_FLAGS := --compiler-filter=interpret-only
+$(call add-product-dex-preopt-module-config,services,--compiler-filter=space)
+</pre>
<p>For a major version upgrade OTA, it can be useful to blacklist certain apps
from being pre-optimized since they will likely be out of date. This can be
@@ -461,11 +508,15 @@ done by specifying <code>LOCAL_DEX_PREOPT</code> (for all products) or with
<p>BoardConfig.mk:</p>
-<pre><code>WITH_DEXPREOPT := true</code></pre>
+<pre class="devsite-click-to-copy">
+WITH_DEXPREOPT := true
+</pre>
<p>Android.mk (of blacklisted apps):</p>
-<pre><code>LOCAL_DEX_PREOPT := false</code></pre>
+<pre class="devsite-click-to-copy">
+LOCAL_DEX_PREOPT := false
+</pre>
</body>
</html>
diff --git a/en/devices/tech/dalvik/dex-format.html b/en/devices/tech/dalvik/dex-format.html
index 3ff22c0d..fde14a8b 100644
--- a/en/devices/tech/dalvik/dex-format.html
+++ b/en/devices/tech/dalvik/dex-format.html
@@ -291,7 +291,7 @@ in the detection of certain forms of corruption. The value also
encodes a format version number as three decimal digits, which is
expected to increase monotonically over time as the format evolves.</p>
-<pre>
+<pre class="devsite-click-to-copy">
ubyte[8] DEX_FILE_MAGIC = { 0x64 0x65 0x78 0x0a 0x30 0x33 0x38 0x00 }
= "dex\n038\0"
</pre>
@@ -328,7 +328,7 @@ header whose <code>endian_tag</code> is <code>REVERSE_ENDIAN_CONSTANT</code>
instead of <code>ENDIAN_CONSTANT</code>, it would know that the file
has been byte-swapped from the expected form.</p>
-<pre>
+<pre class="devsite-click-to-copy">
uint ENDIAN_CONSTANT = 0x12345678;
uint REVERSE_ENDIAN_CONSTANT = 0x78563412;
</pre>
@@ -345,7 +345,7 @@ an index value is absent.</p>
<p>The chosen value for <code>NO_INDEX</code> is
representable as a single byte in the <code>uleb128p1</code> encoding.</p>
-<pre>
+<pre class="devsite-click-to-copy">
uint NO_INDEX = 0xffffffff; // == -1 if treated as a signed int
</pre>
@@ -2659,7 +2659,7 @@ each register for the <code>DBG_RESTART_LOCAL</code> code.</p>
registers by a small amount and then emit a new position table entry.
The formula for the increments are as follows:</p>
-<pre>
+<pre class="devsite-click-to-copy">
DBG_FIRST_SPECIAL = 0x0a // the smallest special opcode
DBG_LINE_BASE = -4 // the smallest line number increment
DBG_LINE_RANGE = 15 // the number of line increments represented
diff --git a/en/devices/tech/dalvik/gc-debug.html b/en/devices/tech/dalvik/gc-debug.html
index 029fde29..b1a62fe0 100644
--- a/en/devices/tech/dalvik/gc-debug.html
+++ b/en/devices/tech/dalvik/gc-debug.html
@@ -216,8 +216,11 @@ to <code>dalvikvm</code> when starting a command line program. When an app gets
the ANR request signal (SIGQUIT) it dumps information related to its locks,
thread stacks, and GC performance.</p>
-<p>The way to get GC timing dumps is to use:<br>
-<code>$ adb shell kill -S QUIT <pid></code></p>
+<p>The way to get GC timing dumps is to use:</p>
+
+<pre class="devsite-terminal devsite-click-to-copy">
+adb shell kill -S QUIT <var>PID</var>
+</pre>
<p>This creates a <code>traces.txt</code> file in <code>/data/anr/</code>. This
file contains some ANR dumps as well as GC timings. You can locate the
@@ -226,7 +229,7 @@ show a few things that may be of interest. It will show the histogram info for
each GC type’s phases and pauses. The pauses are usually more important to look
at. For example:</p>
-<pre>
+<pre class="devsite-click-to-copy">
sticky concurrent mark sweep paused: Sum: 5.491ms 99% C.I. 1.464ms-2.133ms Avg: 1.830ms Max: 2.133ms
</pre>
@@ -240,14 +243,14 @@ determine if long pauses are caused by the GC being slow or the thread
suspending slowly. Here is an example of what a normal time to suspend
resembles on a Nexus 5:</p>
-<pre>
+<pre class="devsite-click-to-copy">
suspend all histogram: Sum: 1.513ms 99% C.I. 3us-546.560us Avg: 47.281us Max: 601us
</pre>
<p>There are also a few other areas of interest, such as total time spent, GC
throughput, etc. Examples:</p>
-<pre>
+<pre class="devsite-click-to-copy">
Total time spent in GC: 502.251ms
Mean GC size throughput: 92MB/s
Mean GC object throughput: 1.54702e+06 objects/s
@@ -255,15 +258,15 @@ Mean GC object throughput: 1.54702e+06 objects/s
<p>Here is an example of how to dump the GC timings of an already running app:
-<pre>
-$ adb shell kill -s QUIT &lt;pid&gt;
-$ adb pull /data/anr/traces.txt
+<pre class="devsite-click-to-copy">
+<code class="devsite-terminal">adb shell kill -s QUIT <var>PID</var></code>
+<code class="devsite-terminal">adb pull /data/anr/traces.txt</code>
</pre>
<p>At this point the GC timings are inside of traces.txt. Here is example output
from Google maps:</p>
-<pre>
+<pre class="devsite-click-to-copy">
Start Dumping histograms for 34 iterations for sticky concurrent mark sweep
ScanGrayAllocSpaceObjects: Sum: 196.174ms 99% C.I. 0.011ms-11.615ms Avg: 1.442ms Max: 14.091ms
FreeList: Sum: 140.457ms 99% C.I. 6us-1676.749us Avg: 128.505us Max: 9886us
@@ -342,8 +345,8 @@ reasons. The checks will catch a few errors that could cause heap corruption
such as using invalid/stale local and global references. Here is how to enable
CheckJNI:</p>
-<pre>
-$ adb shell setprop dalvik.vm.checkjni true
+<pre class="devsite-terminal devsite-click-to-copy">
+adb shell setprop dalvik.vm.checkjni true
</pre>
<p>Forcecopy mode is another part of CheckJNI that is very useful for detecting
@@ -355,8 +358,8 @@ the red zone don’t match what is expected, this usually means a buffer overrun
or underrun occurred. This would cause CheckJNI to abort. Here is how to enable
forcecopy mode:</p>
-<pre>
-$ adb shell setprop dalvik.vm.jniopts forcecopy
+<pre class="devsite-terminal devsite-click-to-copy">
+adb shell setprop dalvik.vm.jniopts forcecopy
</pre>
<p>One example of an error that CheckJNI should catch is writing past the end of
@@ -388,18 +391,18 @@ that valgrind is orders of magnitude slower than normal execution.</p>
<p>Here is an example use:</p>
-<pre>
+<pre class="devsite-click-to-copy">
# build and install
-$ mmm external/valgrind
-$ adb remount && adb sync
+<code class="devsite-terminal">mmm external/valgrind</code>
+<code class="devsite-terminal">adb remount && adb sync</code>
# disable selinux
-$ adb shell setenforce 0
-$ adb shell setprop wrap.com.android.calculator2
+<code class="devsite-terminal">adb shell setenforce 0</code>
+<code class="devsite-terminal">adb shell setprop wrap.com.android.calculator2</code>
"TMPDIR=/data/data/com.android.calculator2 logwrapper valgrind"
# push symbols
-$ adb shell mkdir /data/local/symbols
-$ adb push $OUT/symbols /data/local/symbols
-$ adb logcat
+<code class="devsite-terminal">adb shell mkdir /data/local/symbols</code>
+<code class="devsite-terminal">adb push $OUT/symbols /data/local/symbols</code>
+<code class="devsite-terminal">adb logcat</code>
</pre>
@@ -410,7 +413,7 @@ useful information:
<code>art E 5955 5955 art/runtime/gc/collector/mark_sweep.cc:383] Tried to mark 0x2
not contained by any spaces</code></p>
-<pre>
+<pre class="devsite-click-to-copy">
art E 5955 5955 art/runtime/gc/collector/mark_sweep.cc:384] Attempting see if
it's a bad root
art E 5955 5955 art/runtime/gc/collector/mark_sweep.cc:485] Found invalid
@@ -435,7 +438,7 @@ href="https://android-review.googlesource.com/#/c/133932/">https://android-revie
<p>In the case where the object isn’t a root, output similar to the following
prints:</p>
-<pre>
+<pre class="devsite-click-to-copy">
01-15 12:38:00.196 1217 1238 E art : Attempting see if it's a bad root
01-15 12:38:00.196 1217 1238 F art :
art/runtime/gc/collector/mark_sweep.cc:381] Can't mark invalid object
diff --git a/en/devices/tech/dalvik/jit-compiler.html b/en/devices/tech/dalvik/jit-compiler.html
index 6c874d84..9090349c 100644
--- a/en/devices/tech/dalvik/jit-compiler.html
+++ b/en/devices/tech/dalvik/jit-compiler.html
@@ -54,7 +54,7 @@ JIT/AOT Compilation</a> on developer.android.com for a more thorough overview.
<h2 id="architectural-overview">Architectural Overview</h2>
-<img src="images/jit-arch.png" alt="JIT architecture" width="633" id="JIT-architecture" />
+<img src="/devices/tech/dalvik/images/jit-arch.png" alt="JIT architecture" width="633" id="JIT-architecture" />
<p class="img-caption">
<strong>Figure 1.</strong> JIT architecture - how it works
</p>
@@ -83,12 +83,12 @@ application has access to the directory.
compilation.</li>
</ol>
-<img src="images/jit-profile-comp.png" alt="Profile-guided comp" width="452" id="JIT-profile-comp" />
+<img src="/devices/tech/dalvik/images/jit-profile-comp.png" alt="Profile-guided comp" width="452" id="JIT-profile-comp" />
<p class="img-caption">
<strong>Figure 2.</strong> Profile-guided compilation
</p>
-<img src="images/jit-daemon.png" alt="JIT daemon" width="718" id="JIT-daemon" />
+<img src="/devices/tech/dalvik/images/jit-daemon.png" alt="JIT daemon" width="718" id="JIT-daemon" />
<p class="img-caption">
<strong>Figure 3.</strong> How the daemon works
</p>
@@ -103,7 +103,7 @@ to behave more like shared libraries.
See the following high-level overview of how JIT works in the next diagram.
</p>
-<img src="images/jit-workflow.png" alt="JIT architecture" width="707" id="JIT-workflow" />
+<img src="/devices/tech/dalvik/images/jit-workflow.png" alt="JIT architecture" width="707" id="JIT-workflow" />
<p class="img-caption">
<strong>Figure 4.</strong> JIT data flow
</p>
@@ -183,7 +183,7 @@ compilation to a later stage). The compilation levels can be configured via
system properties with the defaults being:
</p>
-<pre>
+<pre class="devsite-click-to-copy">
pm.dexopt.install=interpret-only
pm.dexopt.bg-dexopt=speed-profile
pm.dexopt.ab-ota=speed-profile
@@ -211,20 +211,20 @@ copying and pasting. A few common use cases:
<h3 id="turn-on-jit-logging">Turn on JIT logging</h3>
-<pre>
-$ adb root
-$ adb shell stop
-$ adb shell setprop dalvik.vm.extra-opts -verbose:jit
-$ adb shell start
+<pre class="devsite-click-to-copy">
+<code class="devsite-terminal">adb root</code>
+<code class="devsite-terminal">adb shell stop</code>
+<code class="devsite-terminal">adb shell setprop dalvik.vm.extra-opts -verbose:jit</code>
+<code class="devsite-terminal">adb shell start</code>
</pre>
<h3 id="disable-jit-and-run-applications-in-interpreter">Disable JIT</h3>
-<pre>
-$ adb root
-$ adb shell stop
-$ adb shell setprop dalvik.vm.usejit false
-$ adb shell start
+<pre class="devsite-click-to-copy">
+<code class="devsite-terminal">adb root</code>
+<code class="devsite-terminal">adb shell stop</code>
+<code class="devsite-terminal">adb shell setprop dalvik.vm.usejit false</code>
+<code class="devsite-terminal">adb shell start</code>
</pre>
<h3 id="force-compilation-of-a-specific-package">Force compilation of a specific
@@ -232,11 +232,15 @@ package</h3>
<ul>
<li>Profile-based:
-<code>$ adb shell cmd package compile -m speed-profile -f
-my-package</code>
+<pre class="devsite-terminal devsite-click-to-copy">
+adb shell cmd package compile -m speed-profile -f my-package
+</pre>
+</li>
<li>Full:
-<code>$ adb shell cmd package compile -m speed -f
-my-package</code></li>
+<pre class="devsite-terminal devsite-click-to-copy">
+adb shell cmd package compile -m speed -f my-package
+</pre>
+</li>
</ul>
<h3 id="force-compilation-of-all-packages">Force compilation of all
@@ -244,20 +248,31 @@ packages</h3>
<ul>
<li>Profile-based:
-<code>$ adb shell cmd package compile -m speed-profile -f
--a</code>
+<pre class="devsite-terminal devsite-click-to-copy">
+adb shell cmd package compile -m speed-profile -f -a
+</pre>
+</li>
<li>Full:
-<code>$ adb shell cmd package compile -m speed -f -a</code></li></ul>
+<pre class="devsite-terminal devsite-click-to-copy">
+adb shell cmd package compile -m speed -f -a
+</pre>
+</li>
+</ul>
<h3 id="clear-profile-data-and-remove-compiled-code">Clear profile data and
remove compiled code</h3>
<ul>
<li>One package:
-<code>$ adb shell cmd package compile --reset my-package</code>
+<pre class="devsite-terminal devsite-click-to-copy">
+adb shell cmd package compile --reset my-package
+</pre>
+</li>
<li>All packages
-<code>$ adb shell cmd package compile --reset
--a</code></li>
+<pre class="devsite-terminal devsite-click-to-copy">
+adb shell cmd package compile --reset -a
+</pre>
+</li>
</ul>
<h2 id="recommendation">Recommendation</h2>
@@ -270,7 +285,7 @@ Note that it is strongly recommended to use the default following
support.
</p>
-<pre>
+<pre class="devsite-click-to-copy">
pm.dexopt.install=interpret-only
pm.dexopt.bg-dexopt=speed-profile
pm.dexopt.boot=verify-profile (or interpret-only)
@@ -281,7 +296,7 @@ Here’s a detailed explanation about the <code>pm.dexopt</code> options, and th
reasoning for our recommendations:
</p>
-<pre>
+<pre class="devsite-click-to-copy">
pm.dexopt.install
</pre>
@@ -290,7 +305,7 @@ This is the compilation filter used when installing application through the
Play Store. For faster installs we recommend <code>interpret-only</code>.
</p>
-<pre>
+<pre class="devsite-click-to-copy">
pm.dexopt.bg-dexopt
</pre>
@@ -300,7 +315,7 @@ fully charged. We recommend using <code>speed-profile</code> to take advantage
of profile guided compilation and save on storage.
</p>
-<pre>
+<pre class="devsite-click-to-copy">
pm.dexopt.ab-ota
</pre>
@@ -311,7 +326,7 @@ update. If the device supports A/B OTA, we recommend using
save on storage.
</p>
-<pre>
+<pre class="devsite-click-to-copy">
pm.dexopt.nsys-library
pm.dexopt.shared-apk
pm.dexopt.core-app
@@ -324,7 +339,7 @@ the <code>speed</code> filter, as the platform does not support efficient
profiling of them.
</p>
-<pre>
+<pre class="devsite-click-to-copy">
pm.dexopt.first-boot
</pre>
@@ -336,7 +351,7 @@ use the phone for the very first time. Note that if all applications in /system
are already speed compiled, <code>pm.dexopt.first-boot</code> has no effect.
</p>
-<pre>
+<pre class="devsite-click-to-copy">
pm.dexopt.boot
</pre>
@@ -364,11 +379,13 @@ filter. To do this, edit the following files to include these entries.
<p>Add the following entry to <code>BoardConfig.mk</code>:</p>
-<pre>WITH_DEXPREOPT := true</pre>
+<pre class="devsite-click-to-copy">
+WITH_DEXPREOPT := true
+</pre>
<p>Add the following entry to <code>device.mk</code>:</p>
-<pre>
+<pre class="devsite-click-to-copy">
PRODUCT_DEX_PREOPT_DEFAULT_FLAGS := --compiler-filter=interpret-only
</pre>