My basic questions: Why does the GPU processing time spike when performing simple things in the update method of a game object when there is literally nothing to render? And why is the total GPU processing time in the profiler so much higher than what it adds up to from the function call table and what is it doing during that missed time that takes so long?
More Info: I made a simple test project to demonstrate this effect, there is only a single empty game object with nothing else (no cameras or lights) and it has one thing in the update function that just runs a really long for loop that continually divides two numbers (takes ~100 ms to run) when I hit a key. When I hit the key processing time spikes in both the CPU and GPU (see pic, I hit it a bunch there but it happens if I do it just once too) but this is confusing to me as there’s no reason for the GPU to be doing anything as far as I’m aware, there isn’t even a camera or anything to display.
So then why does it spike higher than the CPU time even and more importantly I can’t debug this because nothing appears in the GPU profiler table, it just has 1 call to RenderTexture.SetActive which takes 0 ms despite having deep profile on and it says the total GPU time was 228 ms. Even when not running the for loop the GPU time is at ~15 ms still, what is it doing during that time? One last thing worth mentioning is that this happens with V sync on or off.
This simple example correlates well to what I noticed in my main game and this added GPU time really does contribute significantly to a slow FPS.
(Also, in the pic where it looks like the CPU time dips down it actually goes up a ton to ~100 ms, not down to 0 as the plot would suggest).
I’m using Unity 5.3.3f1, any help greatly appreciated in trying to understand this, thanks!