我需要获取我在使用NDK/JNI实现的算法中某些部分的计算时间。
我看过这个问题:Android Get Current timestamp?
我认为我可以用相同的方法来获取JNI调用的计算时间,具体做法如下:
Long start, end, time;
start = System.currentTimeMillis()/1000;
//my native call
end = System.currentTimeMillis()/1000;
time = end - start;
Log.i(TAG, "Time ... (ms): " + time);
但我需要检查本地方法中某些小部分的计算时间。我该怎么办?
currentTimeMillis()
除以1000... 你想要测量的粒度是秒吗? - mah