Index

Image A

Android Native Development Kit (NDK), 33, 73

Android devices and architectures, 35

Application Binary Interfaces, 35

ARM assembly code, 7374

ARM instructions, 8796

ARM NEON registers, 9697

C extensions, 98

built-in functions, 99

vector instructions, 99103

C/C++, performance improvements, 53

ARM assembly code, 5455

Dalvik bytecode, 54

Fibonacci.computeIterativelyFaster() method, 53

iterativeFaster() implementations, 5657

JNI glue layer (see JNI glue layer)

test and compare, 5556

color conversion, 79

Android.mk, 82

ARMv5 Assembly code (ARM Mode), 80

ARMv5 Assembly code (Thumb Mode), 80

ARMv7 Assembly code (ARM Mode), 80

ARMv7 Assembly code (Thumb Mode), 81

function implementation, 79

Hand-crafted Assembly code, 81

x86 Assembly code, 80

components, 34

CPU features, 9798

directories, 34

greatest common divisor, 74

Android.mk, 78

ARMv5 Assembly code, 76, 77

ARMv7 Assembly code, 76, 77

disassembled gcd_asm code, 79

function implementation, 75

Hand-crafted Assembly code, 78

x86 Assembly code, 75

inlining functions, 104

LDM/STM, 106107

MIPS technologies, 36

mixing java and C/C++ code, 37

JNI glue layer implementation (see JNI glue layer)

Makefiles (see Makefiles)

native function implementation, 4143

native library, 4344

native method declaration, 37

NativeActivity class, 62

alternatives, 7071

Android.mk, 64

header files, 6263

manifest files, 63

myapp.c, 64, 6570

new revisions, 36

parallel average function

Android.mk, 86

ARMv5 Assembly code (ARM mode), 83

ARMv5 Assembly code (Thumb mode), 84

ARMv7 Assembly code (ARM mode), 83

ARMv7 Assembly code (Thumb mode), 84, 85

Assembly code mixed with C code, 86

faster implementation, 84

function implementation, 83

Hand-crafted Assembly code, 85

x86 Assembly code, 83

preloading memory, 105106

README text file, 34

unrolling loops, 104

Android.mk, basic version, 40

Android.mk file

LOCAL_ARM_MODE, 52

LOCAL_ARM_NEON, 52

LOCAL_CFLAGS and LOCAL_CPPFLAGS, 52

LOCAL_DISABLE_NO_EXECUTE, 52

modules, 53

variables, 5152

Application Binary Interfaces (ABIs), 35

Application Not Responding (ANR) dialog, 21

Application.mk

armeabi ABI, 40

basic version, 40

Application.mk file

APP_ABI, 46

APP_CFLAGS and APP_CPPFLAGS, 45

APP_OPTIM, 45

APP_STL, 4546

Java implementation

library files, 48

using strategy pattern, 49

libfibonacci.so, 47

MIPS-based Android system, 48

primary and secondary ABIs, 47

strategy pattern, 49, 50

variables, 44

ARM Embedded Application Binary Interface, 35

ARM instructions, 8796

armeabi, 35

Image B, C

Battery life, 177

alarms, 201

ELAPSED_TIME_WAKEUP, 202

RTC and ELAPSED_TIME, 202

RTC_WAKEUP, 202

schedule alarms, 203204

service implementation, 201202

broadcast receiver

ACTION_BATTERY_CHANGED, 183

BatteryReceiver implementation, 184

broadcast intents, 183

declaration, 184

enabling and disabling, 186187

registerReceiver(), 183

Toast messages, 185

capacities, 177178

G1Phone power consumption, 190

graphics, 200201

location updates, 191

filtering providers, 196198

flaws, 192

frequency of updates, 193194

GPS location updates, 192

last known location, 198199

location providers, 192, 194196

network location updates, 192

unregister a listener, 193

network information

active connection, 187

background data setting, 188189

data connections, 187

data transfer rates, 189191

sensors, 199200

usage

screen and Wi-Fi, 179

sticky intent, 180182

WakeLocks

flags, 204

problems, 205206

WakeLock creation, 204

Benchmarking and profiling, 163

measuring time

applications, 163

Debug.threadCpuTimeNanos(), 165, 166

System.currentTimeMillis(), 164

System.nanoTime(), 164, 165

tracing, 167

Debug.startMethodTracing() method, 167

logging, 174175

native tracing, 172174

traceview, 168172

BigInteger Version

computeIterativelyFaster, 7

Faster Recursive implementation, 811

Fibonacci Q-matrix, 8

lackluster performance, 7

Image D, E

Dalvik bytecode, 2

Dalvik Just-In-Time (JIT) compiler, 33

Dalvik virtual machine, 3

Debug.startMethodTracing() method, 167

Debug.threadCpuTimeNanos(), 165, 166

Image F

Fibonacci series

BigInteger version (see BigInteger version)

definition, 2

faster recursive implementation

using BigInteger, 8

using BigInteger and long Primitive Type, 9

using BigInteger and Precomputed results, 10

using BigInteger, long Primitive Type and Cache, 11

human-readable Dalvik bytecode, 2

Naïve recursive Implementation, 2

optimization

iterative implementation, 5

modified iterative implementation, 56

recursive implementation, 811

Fibonacci.computeIterativelyFaster() method, 53

Image G

Garbage collector

GC_CONCURRENT, 130

GC_EXPLICIT, 130

GC_EXTERNAL_ALLOC, 130

GC_FOR_MALLOC, 130

GC_HPROF_DUMP_HEAP, 130

log messages, 130

memory leaks

DDMS perspective, 125

StrictMode class, 126127

references

phantom references, 128129

reference queues, 129130

soft and weak references, 128

strong references, 127128

GPS location provider, 194

Graphics, 207

culling, 229

layout tools, 217

merging layout, 213214

Mipmaps, 226227

Multiple APKs, 228

OpenGL ES, 218

extensions, 219221

texture compression (see Textures, OpenGL ES)

optimizing layouts

default layout, 208

setContentView(), 207, 208

power consumption, 230

relativelayout, 209213

render mode, 229

reusing layout, 214215

scene complexity, 229

shaders, 228

view stubs, 215217

Greatest common divisor (gcd), 74

Android.mk, 78

ARMv5 Assembly code

ARM Mode, 76

Thumb Mode, 77

ARMv7 Assembly code

ARM Mode, 76

Thumb Mode, 77

disassembled gcd_asm code, 79

function implementation, 75

Hand-crafted Assembly code, 78

x86 Assembly code, 75

Image H, I

Handlers, 140142

Hierarchy Viewer, 218

Image J, K

Java code optimization, 1

API levels, 1316

data structures, 17

in java.util package, 18

using LruCache, 18

OutOfMemoryError exception, 19

execution, 2

Dalvik bytecode, 2

dexdump tool, 2

Fibonacci series, 2

Google benchmarks, 3

JIT compiler, 3

strategies, 34

virtual register, 3

vmSafeMode, 4

fragmentation, 1617

responsiveness, 20

classes, 20

main thread, 20

procrastination, 2223

startup sequence, 21

StrictMode, 2324

SQLite, 25

queries, 3031

SQLite statements, 2528

transactions, 2830

using cache, 11

android.util.LruCache<K, V>, 1213

Faster Recursive Implementation, 11

HashMap, 11

SparseArray, 11

Java Virtual Machine (VM), 2

java.math package, 6

JNI glue layer, 57

access fields and methods, 5962

C Source file, 39

header file, 6263

Java Development Kit, 38

JNIEnv object, 39

strings, 5859

Just-In-Time (JIT) compiler, 3, 33

Image L

Layoutopt, 218

Logging, 174175

Loopers, 142

Low-Level Virtual Machine (LLVM), 233

Image M

Makefiles

Android.mk (see Android.mk)

Application.mk (see Application.mk)

LOCAL_MODULE, 41

my-dir macro, 40

ndk-build tool, 40

shared library, 41

Memory management, 109

APIs, 131

data types

add two 64-bit integers, 111

add_16_16 with two 32-bit values, 113

add_16_16's C and assembly, 111

add_16_32's C and assembly, 111

assembly code, 111, 112

BitSet class, 117118

cache line size, 119120

cache miss, 119

comparing two values, 113115

Level 1 and 2 cache, 119

sorting arrays, 116117

sorting, finding and summing, 115116

sum of two 32-bit values, 111

garbage collection, 125

GC_CONCURRENT, 130

GC_EXPLICIT, 130

GC_EXTERNAL_ALLOC, 130

GC_FOR_MALLOC, 130

GC_HPROF_DUMP_HEAP, 130

log messages, 130

memory leaks, 125127

references, 127130

getMemoryInfo() methods, 131

Java primitive types, 110

modified MyRecords class

using short array, 123

using two array, 124125

modified sum values(), 122

onLowMemory(), 131

performance, 110

physical memory, 109

Record class, 121

saving records, 121122

virtual memory swapping, 109

Mipmaps, 226227

Multithreading and synchronization, 133

activity's lifecycle

computation, progression, 158161

Fibonacci Number computation, 154, 155

passing information, 156158

AsyncTask, 137

multiple file downloading, 138

protected methods, 138

sequence implementation, 137, 138

UI thread and execution, 139

concurrency, 147

data types

Java language, 143, 144

synchronized keywords, 143, 144

Synchronized Statements, 146

volatile keyword addition, 145

handlers, 140142

loopers, 142

multicore

algorithm modification, 149152

concurrent cache, 152154

dual core CPUs, 148, 149

threads

code execution, 134

creation, 134

Fibonacci number computation, 135

non-UI thread, 135

priority, 136137

Image N, O

Native code, 35

NEON registers, 96

Network location provider, 194

Image P, Q

Passive location provider, 195

Image R

RenderScript, 231

Balls sample application, 231

Hello rendering, 236

Content View setting, 239, 240

RenderScriptGL context creation, 238

RSSurfaceView, 239

script creation, 237

Hello, World script, 233

auto-generated file, 234, 235

calling function, 235

LLVM Assembly Language, 236

HelloCompute

allocations, 244, 245

performance, 248, 249

RenderScript mono.rs, 243

root() function, 244

rsForEach function, 245248

LLVM bitcode, 233

native code, 233

native RenderScript APIs

definition, 249, 250

rs_atomic.rsh, 262

rs_cl.rsh, 255258

rs_core.rsh, 253255

rs_graphics.rsh, 260261

rs_math.rsh, 259260

rs_time.rsh, 261, 262

rs_types.rsh, 250253

vs. NDK, 263

variable addition

alpha component, 242

background Color, 240

blue variable, 242

get() method, 243

global red and green variable, 242

ScriptC_hellorendering2.java, 241, 242

YouTube Carousel view, 231

Image S

SQLite

queries, 3031

SQLite statements

cheese database, 26

compilation, 27

execution, 25

populateWithCompileStatement, 28

StringBuilder/String format version, 26

transactions, 28

Atomic commit, 28

performance, 29

System.nanoTime(), 164, 165

Image T, U

Textures, OpenGL ES, 221

ARM Mali GPU Compression tool, 223, 224

compression formats, 221

ETC1 compression format, 222

ETC1 compression vs. original image, 222

etcpack tool, 222

Imagination Technologies, 224

manifest, 225, 226

PowerVR, 225

uncompressed textures, 221

Image V, W, X, Y, Z

Virtual register, 3

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.145.174.183