'Measure compute shader execution time in Unity

Is there a way to measure the execution time of a given compute shader in Unity ?

I thought to "artificialy" add a compute buffer in this compute shader and make a "getData" on it, because I know this function will block the cpu, until the gpu calculation is over. But, it seems a bit rough as a method... moreover, how to know how long the getdata will last in this case ?



Solution 1:[1]

Maybe measuring the time between Dispatch and AsyncGPUReadbackRequest.done helps

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 esgnn