- compileOptions inclduing the sourceCompatibility and targetCompatibility testInstrumentationRunner
- packagingOptions multiple cppFlags and ldLibs
- specifying of debug ndk abiFilters
- dynamic generation of android.productFlavors
- dependencies of 'com.android.support.test:runner:0.3' and 'com.android.support.test:rules:0.3' must be compile
A Fuzzy Philosopher
WANDERING BETWEEN SIN AND DISCIPLINE,
WHAT I CAN DO IS MERELY TO LOOK AROUND AND LINGER ON IN VANITY FAIR.
--- FOREVER AND EVER
Saturday, July 25, 2015
A Complete build.gradle for the Experimental Android Gradle Plugin
Along with the latest release of Android Studio 1.3 rc3, the experimental gradle plugin supports NDK integration in a seamless way. However, the official quick guide does not show every essential detail to write a working build.gradle. The tricks to pay attention to is as follows.
Tuesday, April 14, 2015
Essential Instructions to Install Custom Recovery on Galaxy S2
A custom recovery allows to install a custom ROM with adb sideload by disabling signature verification. This tutorial is for Galaxy S2 on OSX. The Android fastboot is not applicable for Samsung devices.
Prep.
- install the Android SDK and set PATH to platform-tools/
- download and install Heimdall to flash
- download CWM for Galaxy S2 AT&T or others models here
Instructions
- unzip CWM to have zImage in the current directory
- turn off the device
- press Power + Volume Down + HOME to turn on the device
- press Volume Up to continue to enter the Download mode
- type the following command to flash with the custom recovery
$> sudo heimdall flash --KERNEL zImage --no-reboot
NOTE
- The custom recovery allows to install a custom ROM with adb sideload.
- If failed with error messages, turn off the device and retry.
Saturday, April 11, 2015
OSX Command Line Tools 6.3 Fails Compiling Open Source Packages and C++
Along with the recent release of OSX 10.10.3 and Xcode 6.3, the Command Line Tools 6.3 is available to update from the AppStore. However, the update may fail the compilation of open source packages such the Valgrind whose configure script fails to determine if the compiler is based on LLVM. Even though it is possible to modify the script to pass, the compilation still fails due to 64/32-bit absolute addresses. In general compilation of c++ code, the Missing c++ header <__debug> after updating OSX Command Line Tools 6.3 is probably the most annoying. There are some workarounds are posted on the thread following the link. The issue is also verified by Apple on their developer's forum. Currently, downgrading to 6.2 should make sure everything works as usual.
Sunday, April 5, 2015
Proper Usage of Java 8 Parallel Stream
Java 8 stream incorporates parallel constructs for ease of speedup over collection of items. However, it is not guaranteed unless used appropriately. Here are the justifications by Dough Lea1.
In terms of workload
Java 8 parallel stream speeds up sequential work processing by forking threads to exploit potential parallelism but implicit thread setup cost that may weigh down the expected benefits. The total workload estimation from sequential processing is to multiply by defined as follows. Only when is it worth it.
- Assume there are elements to process in the source collection
- Assume work function cost by lines of code or statements
Startup
- Power control slows down the startup of cores with overhead imposed by JVMs, OSes, and hypervisors.
- Too fine grained work splitting causes startup cost to dominate the parallel processing benefits.
- Random accessible data structures expose more parallel processing speedup over linked lists, blocking queues and IO-based sources for lower access overhead.
Concerns
- JVMs may not figure out sensibly and deliver uniform speedup in general so that Java 8 Stream simply delegates the decision making to users.
- Collections may weigh the pros and cons to return a sequential or parallel stream interface selectively in term of some cost measure.
- Sequential I/O and synchronization tasks should be avoided.
- I/O sources require custom development of Stream interfaces.
- Overhead in sequential processing is likely to be magnified in parallel processing in the following aspects.
- cache-locality
- garbage-collection rates
- JIT compilation
- memory contention
- data layout
- OS scheduling policies
- the presence of hypervisors
Thursday, January 22, 2015
Wednesday, December 3, 2014
Android ART Runtime might not Benefit Apps Running Native Code
A recent experiment on the performance of Android apps Android indicates the ART runtime might not significantly benefit apps already running native code. The benchmark app Speaker Identifier computes MFCCs for voice recognition which are usually computation intensive for mobile devices and implementation in native code is a typical solution. Here are the resource usages derived from implementations in two stream processing toolkits, ESMS and StreamIt on Nexus 7 2013 w/ and w/o ART enabled. As is shown, the CPU utilization (CPU time / real time) w/ ART in contrast with Dalvik even increased slightly, implying the pre-compilation overhead, and 5MB more RSS (max. runtime memory) usage. Though, apps implemented and running mostly in Java should still gain performance improvements, developers working on native performance enhancement remain.
Nexus 7 2013, Android 4.4ESMS Dalvik
Audio format: 44.1 KHz, MONO
Buffering: 0.04s
200.18 real, 29.49 user, 0.02 sys, 14.74% CPUESMS ART
RSS: 26734592, Text: 0, Data: 0, Stack: 0
Page faults 0, reclaims: 135
Swaps: 0, Voluntary: 9848, Involuntary: 3049
200.21 real, 28.97 user, 1.03 sys, 14.98% CPUStreamIt Dalvik
RSS: 31498240, Text: 0, Data: 0, Stack: 0
Page faults 0, reclaims: 118
Swaps: 0, Voluntary: 9844, Involuntary: 2475
200.23 real, 48.74 user, 1.01 sys, 24.85% CPUStreamIt ART
RSS: 27365376, Text: 0, Data: 0, Stack: 0
Page faults 0, reclaims: 218
Swaps: 0, Voluntary: 9828, Involuntary: 3612
200.20 real, 51.46 user, 0.02 sys, 25.71% CPU
RSS: 32129024, Text: 0, Data: 0, Stack: 0
Page faults 0, reclaims: 200
Swaps: 0, Voluntary: 9828, Involuntary: 3230
Saturday, November 22, 2014
Dict Eye Demonstration
Subscribe to:
Posts (Atom)