Metal GPU Time Profiling

How can one get the GPU timings in Metal?

APIs like D3D and OpenGL (with extensions) expose the notion of GPU Timestamp and Disjoint queries which when used togeather allow to measure the time GPU took executing commands.

Is there a equivalent API in Metal?


Alternatively, is there a way to emulate that? For example there are engines out there that read GPU clock value in the Vertex Shader and store that in an UAV. Is there anuthing like that?