You can use C ++ 11 functions in jni. For example, Chrono:
std::high_resolution_clock::time_point t1 = std::chrono::high_resolution_clock::now();
{
}
std::high_resolution_clock::time_point t2 = std::chrono::high_resolution_clock::now();
int duration = std::chrono::duration_cast<std::chrono::nanoseconds>(t2-t1).count();
or any other type of time from http://en.cppreference.com/w/cpp/chrono/duration
source
share