- Home /
WaitForTargetFps using high cpu
Hi, I am new to Unity. I am trying to write a simple benchmarking application.
Right now, all I am doing is rendering a single Quad (2 triangles) to the screen. I have no Update() methods defined right now and have not explicitly set Application.targetFrameRate or QualitySettings.vSyncCount to anything.
What I am experiencing is WaitForTargetFps using up so much of my CPU that it causes my framerates to drop (or so it seems). My app by default is running at ~38fps and using 28ms of CPU and GPU time.
I understand that the WaitForTargetFps is sort of like a wait loop until Vsync is fired, but based on this data I collected below where I set the vSyncCount to various values, something doesn't make sense to me.
vSyncCount FPS CpuTime(main thread) CpuTime(render thread) GpuTime
0 93 10.7ms 0.1ms 10.7ms
1 38 26.0ms 0.2ms 26.0ms
2 17 58.7ms 0.2ms 58.7ms
How is it I can't run at 30fps cleanly when I have the vSyncCount set to 2 when I'm able to run at 93fps when I have the vSyncCount turned off? I understand the timing of things can cause problems, and I could understand that as an excuse for not meeting the 60fps target when vSyncCount is set to 1, but I can't explain the 30fps one.
Also, when vSyncCount is set to 0, I still see 95% of my CPU time spen in the WaitForTargetFPS method. What's this about?
Thanks in advance for any help.
EDIT Not sure what I did, but I messed with the targetFrameRate value a bit, and now when I set vSyncCount to 0 (targetFrameRate is commented out) I am getting updwards of 700 fps. This all feels like there is some other workings at play that I don't understand.