Best practice for determining FPS

Is there a best practice for a Metal app to determing its current frame rate (or

if it is meeting the target frame rate)? The goal being to dynamicly adjust the

work being done, to keep the frame rate at an acceptable level.


Background: I have an AppleTV Metal app who's frame rate is dominated

by the work done in a compute kernel. The work done in the kernel was tuned

based on 4th gen AppleTV performance when it was developed, and now

I'm updating it to dynamically take advantage of the higher performance

of the 5th gen.


Initial testing indicates compute kernel performance on 5th gen

is about 2.5 to 3 times that of 4th gen. Does that seem reasonable

or should I expect more?

Replies

It is a pity that GPU timers are available when compiling for GL and GLES platforms, but completely absent in Metal.
For iOS Metal, you can at least use "MTLCommandQueue.GPUStartTime" and "MTLCommandQueue.GPUEndTime". Unfortunately, these functions are not available for macOS or tvOS.