You can get frame timing data from the FrameTiming
API in the following ways:
To get frame timing data from release builds, you must first enable the Frame Timing Stats property.
To view frame timing data in a custom Profiler module perform the following steps:
FrameTimingStats
property enables. You can then click on the relevant counters in the submenu to add them to your custom module.For a list of available counters, refer to Profiler counters reference.
The Highlights Profiler module uses FrameTiming
to determine whether a frame is CPU or GPU bound.
Use the FrameTiming
API to access timestamp information. In each variable, FrameTimingManager
records the time a specific event happens during a frame.
The following table contains the values available through the API, in the order that Unity executes them during a frame:
Property | Description |
---|---|
frameStartTimestamp |
The CPU timestamp time when the frame begins. |
firstSubmitTimestamp |
The CPU timestamp time when Unity submits the first job to the GPU during this frame. |
cpuTimePresentCalled |
The CPU timestamp time when Unity calls the Present() function for the current frame. |
cpuTimeFrameComplete |
The CPU timestamp time when the GPU finishes rendering the frame and interrupts the CPU. |
Use FrameTimingManager.GetCpuTimerFrequency
API to convert the timestamp to seconds.