Random spike in CPU usage and longer render times
Hello, I am a developer on a Unity app for Quest 2. We have a performance problem with our app that causes huge spikes in CPU usage. The app performs well and as we want it to at first, seen here captured by OVR metrics: All of the systems in the app test well and do not cause problems but after a certain amount of time doing various things, a user has a random random chance of having the framerate plummet. In this next picture, I experienced the bug and then returned to the login screen where the bug persisted: You can see that CPU usage has skyrocketed to a locked 100%. You would think that there is some process taking up frame time in the background. I took a look at the profiler on a build to see if there was a key culprit. Here is a frame under good conditions where performance is as expected: And after the bug, the frame looks like this: You can see that the player loop has almost doubled in duration, but the scripts portion of the frame is actually pretty much the same. The change is entirely in EarlyUpdate.XRUpdate and PostLateUpdate.FinishFrameRendering taking 5x as long as before. So why am I getting a huge CPU usage spike while also the rendering of the same workload is suddenly taking so much longer?? Is there any chance that the quest is downclocking under stress? Once this happens, there is no way to retrieve the old performance until you restart the app completely. There is no surefire way to trigger this to happen, it just randomly takes place when there's a decent amount going on and then stays forever. I do not understand what APP T and TW T mean in the OVR metrics panel as well, if those might lead to a culprit. Any ideas would be much appreciated, thank you.1KViews0likes0CommentsPlease help me understand Unity Profiler and RenderDoc output for my simple app
I have a simple scene that is performant on PCVR, but struggles to make a reasonable frame rate when run natively on Quest. After stripping out about half the scene geometry and some of the shadow overhead, it is still failing to run smoothly so I've run the Unity Profiler (Standalone) and RenderDoc to try to understand where my bottlenecks are. This development is currently running in Unity 2021.2.14f1, GLES, with up-to-date Oculus XR Plugin and Oculus Integration packages. Please look at the following and let me know if anything jumps out that I should look for. First, Unity profiler: The profiler suggests nearly 32ms of my 43ms PlayerLoop is waiting in EarlyUpdate.XRUpdate->OculusRuntime.WaitToBeginFrame. I've seen discussion online that suggests this is most likely related to "Vsync" like timing and missing a frame budget could cause excess time waiting on the next available frame. But I don't understand why it should appear to be almost 33 ms. At 13ms per frame @72Hzthat's almost 2.5 frame budgets every frame cycle. Because I can't get accurate timings of the GPU in the profiler, I can only see the Batches (20) and Tris count(~27K) and these should both be well-within recommended limits. I've highlighted what I *think* illustrates the RenderLoop timing as best I can and it seems to imply some 4-5 ms where the RenderThread is not in WaitForGfxCommands... Trying to dig deeper into the GPU, I've captured a frame under RenderDoc. Two quick up-front questions about RenderDoc and "Gather Timings", if anyone knows the answer... You must capture the frame under "Quest Mode", but can Replay it under "Quest Mode" or "Quest Profiling Mode" I get ~42ms under the former and 12ms under the latter. Which one is more trustworthy here? Should Gather Timings report times for each stage in the series, because I can only get it to report for the entire frame. I'd love deeper information for timing, but I can't seem to get at it. Finally, RenderDoc echoes the 20 Draw Calls, but I can't tell whether I'm doing anything else here which should be causing such poor performance. My overall framerate is around 27, but I can't understand why. Please advise if I've got something obvious going on, but I'm at a loss to explain the behavior I'm seeing. TIA, G76.6KViews2likes5Comments