title: Measure time in Java JNI ( native call Java)
body: <p>I am trying to measure time in JNI call, it call from native to Java.</p>
  
  <p>In C code, I apply "GetTickCount" api to get JNI execution time and "System.nano" in Java.</p>
  
  <p>Example:</p>
  
  <pre><code>long start = GetTickCount();
  ....//CallStaticMethod exampleMethod...
  long end = GetTickCount();
  long duration = end - start;
  </code></pre>
  
  <p>And in Java</p>
  
  <pre><code>public static exampleMethod(){
      long start = System.nano();
      //do something
      long end = System.nano();
      long duration = TimeUnit.NANOSECONDS.toMilis(end - start);
  }
  </code></pre>
  
  <p>Sometimes, it is inconsistent because the java's duration is more than C's duration. ( about 5 to 10 miliseconds)</p>