Hello, I am trying to profile the read speed times of different memory layouts and access types (global vs thread, using more cache friendly layouts etc...)
For that I have made two compute shaders which use a for loop to read whatever memory I am testing X times. (Always adding to a sum so compiler hopefully doesn't remove it) and then I dispatch a single thread to perform it using the following code:
var stopWatch = Stopwatch.StartNew();
testCase.shader.Dispatch(kernel, 1, 1, 1);
resultBuf.GetData(result);
stopWatch.Stop();
Result in this case is the sum (so a single float) which I use to force unity to wait until it completes.
The issue is that a lot of external factors influence time beyond actual code, for example it seems that every consecutive test takes a lot less time. Like a test might take 50% longer just because it was moved from being second to first to occur in the frame.
So I was wondering if there was any more standardized method or tool for profiling compute shaders.
Thanks in advance