javaandroidbenchmarkingcpu-time

How can I measure thread specific time in Android?


In standard JVM (e.g., version 1.8), we can access the current thread's time like this:

ManagementFactory.getThreadMXBean().getCurrentThreadCpuTime();

What is the equivalent methodology to get current thread's time in Android (i.e., Dalvik VM).


Solution

  • So, I found this solution in Android:

    SystemClock.currentThreadTimeMillis(); 
    

    The Android documentation states that this method

    Returns milliseconds running in the current thread.