The surfaceTexture.getTimeStamp()
seems to be giving the correct result. I tested it by adding up all the differences between results returned by consecutive getTimeStamp()
calls and it is equal to the total time the code ran for. This indicates that no frames are being left unconsidered etc.
Another solution I found is this Android app. I do not know how it works but it is giving approximately the same results as the above method.