Update for Frame Timing Manager

Not on all platforms via FrameTimingManager. There may be workarounds with costum heuristics and e.g. native plugins to get some platform specific counters to make up for the lack of FTM. I.e. not trivially and in general, no.

Iā€™m seeing this weird behavior on Android.
In an empty test scene, the average GPU frame time remains roughly around 3.5ms at any FPS below 60 (I tested 5, 10, 15, 20 & 30). At 60 FPS, the GPU frame time jumps up to 10ms.

Could it be device specific? I tested it on a different Samsung device as well and the behavior was very similar but a bit delayed.

Unity 23.1.2f1 - Graphics API Vulkan

I feel like thatā€™s not really a FrameTimingManager thing but something you should check out with a platform specific profiler, like one from your specific deviceā€™s GPU Manufacturer/Designer(e.g. Arm Mobile Studio), for more concrete confirmation, but: Mobile devices have a limited power budget and they have heat build-ups to consider. So the higher the FPS, the more power will be needed by both the CPU and the GPU and more of that at the same time, as there is less idle time on the CPU. The screen may also need extra power for that. All of that means that less power is available at any point in the frame time, more heat is building up and the device is likely to down-clock the GPU as a consequence

That makes a lot of sense. This actually explains why the newer device took some time before thermal throttling the GPU.
Thank you. I will profile with Arm Mobile Studio (and other tools mentioned in ultimate profiling guide) for a more detailed analysis if the need arises.

1 Like

I might be being really stupid, but on DX11/DX12, the frametiming stuff works wonderfully in editor, but not in a Windows build. I ticked the box under Player settings. Why is everything coming back as 0? 2022.3.3f1.

Google shows this page for many GPU profiling queries. Can you please elaborate on how to open this window, or at least point to a page that explains it?

Is it possible to get the gpuFrameTime on Quest 2 using OpenGLES3 and OpenXR?

This post might hint that itā€™s not supported yet?

Can somebody help me understand the values a bit better. I have tested a build on a Samsung S10 (OpenGLES3). Itā€™s running at 60fps. Frame time is 16ms, as expected. CPU time is 11ms which is understandable. GPU frame time is reported as 20ms. How can that be explained? As far as I understood this thread, only Metal could potentially report a higher GPU time than general frame time. Am I missing something? (2022.2.17, URP 14.0.7)

1 Like

If itā€™s only available in 2022 why is it in the documentation for 2021. With examples. This is just wasting peopleā€™s time.

If youā€™re on Unity 2021, what options do you have for getting GPU frame timings?

Sorry for this - as a part of Dynamic Resolution feature we only supported on 2021 iOS
, macOS and tvOS (Metal only), Android (Vulkan only), Windows Standalone (DirectX 12 only), and UWP (DirectX 12 only). Weā€™ve extended support to almost all platforms it in 2022, but it required changes that could destabilize 2021, so we didnā€™t backport those changes to 2021.

One option you may be able to use depending on the platform is native graphics plugin API - https://docs.unity3d.com/2021.3/Documentation/Manual/NativePluginInterface.html
It should be possible to obtain the render device and use it to issue timestamps/timerqueries at a certain point of frame and collect later.

2 Likes

It turns out it does work for my platform in 2021.3 :smile:, just not in the editor.

1 Like

Funny. For me it works in the editor and standalone development builds but NOT in standalone release builds. :confused:
Unity 2021.3.22f1

The improvements mentioned in this thread landed on 2022.1.0a14

Thank you! Understandable.

1 Like

Hi, I was wondering if you could help.

I am using Unity 2022.3.14f1.

I have a script that collects profiling data using ProfileRecorders with the Time Manager Manager enabled over 60 frames. However the data I am collecting seems quite inconsistent and it would be great to get some clarification on what I am seeing.

The stats I am collecting are :-

ā€œCPU Total Frame Timeā€
ā€œCPU Main Thread Frame Timeā€
ā€œCPU Render Thread Frame Timeā€
ā€œGPU Frame Timeā€
ā€œMain Threadā€
ā€œPlayerLoopā€

The problem I am seeing is that ā€œCPU Total Frame Timeā€, ā€œCPU Main Thread Frame Timeā€, ā€œMain Threadā€ and ā€œPlayerLoopā€ stats seem quite inconsistent, for example on one frame ā€œCPU Total Frame Timeā€ is the slower value where as on another ā€œCPU Main Thread Frame Timeā€ is slower and another the ā€œPlayerLoopā€ stat is slower.

I would expect that there should be a stat that is consistently the slowest stat, that stat shows the time the whole frame takes on the CPU(including waiting for other threads to sync with the main thread).

Any information on this would be of great help.

For others following along, the above has been answered in this thread .

1 Like

This ProfilerRecorder returns zeroes in non-Development Build iOS players, but works fine in Development Build iOS players, and in Unity Editor regardless of the Development Build setting. I am intentionally not setting the project setting to enable the FrameTimingManager in all builds, as the only release builds we want it enabled in are internal.
ā€œCPU Main Thread Frame Timeā€ and ā€œCPU Render Thread Frame Timeā€ ProfilerRecorders do not have this inconsistency. (2022.3.23f1, URP 14.0.10)

m_gpuRecorder = ProfilerRecorder.StartNew(ProfilerCategory.Internal, "GPU Frame Time");

@chrismarch_1 thanks to you we noticed the examples here and in the documentation have not been updated to reflect the fact that these counters donā€™t belong to the Internal category but to the Rendering one. That was a late change to the code when the examples were already written.

Iā€™m not sure thatā€™d fix your issue but I didnā€™t get to test that theory. Iā€™m on PTO for the next week and didnā€™t want to leave you hanging for too long though. If you give that a try, please let me know if that worked :slight_smile:

1 Like

Are the stats from the Frame Timing Manager the same as those in the DisplayStats of the URP Rendering Debugger?

(The overlay you can open by double tapping with 3 fingers on mobile or pressing both controller sticks in, see Rendering Debugger reference | Universal RP | 17.0.3).