I have the following piece of code to try and determine how long a method call takes to execute:
long start = System.nanoTime();
diag(); // diag() is a native method, called via JNI.
long finish = System.nanoTime();
System.out.println("update() took: " + Long.toString(finish - start));
When being executed on a specific Android device (Xperia P), this diff (finish - start) is 0 most of the time.
What is the reason for this? and is there any better way to try measuring the time this method takes to execute and return?
*Note that other Android devices behave differently