b2dGetGPUTime

Returns the average time the GPU spends on a frame, in milliseconds (-1 if it isn't known yet). Takes no parameters.

2D Overlay

Parameters & Returns

Parameters

This function takes no parameters.

Returns

Double

Quick Summary

Returns the average time the GPU spends on a frame, in milliseconds (-1 if it isn't known yet). Takes no parameters.

Technical Exegesis...

The time the graphics card spends drawing each frame, averaged over the last second. On the desktop this is measured with GPU timestamps; on the web it is an estimate (how long the GPU takes to finish the frame after it is sent). Returns -1 until the first second's figure is in, or if the GPU can't be timed.

If the GPU time is close to the frame time, the graphics card is the bottleneck (too many pixels, heavy shaders); if the CPU time is, your program's own code is.

Example

Example.bam
Print "GPU: " & ToString(b2dGetGPUTime()) & " ms"