b2dShowProfiler

Category: 2D Overlay

Syntax:

b2dShowProfiler:Void(enable:Int)


Parameters

Returns

Void



Summary

Shows or hides the built-in profiler panel.

Takes enable (True to show, False to hide).

Shows a small panel in the top right corner (drawn with IGI, so it sits on top of everything and can be dragged anywhere) with:

• FPS, and the frame time in ms (average, best and worst over the last second)
• a graph of the last 120 frame times, where a stutter shows as a spike
• CPU: the time your program's own code took each frame (from the start of the loop to b2dFlip, not counting time spent waiting for the screen)
• GPU: the time the graphics card took to draw the frame. measured exactly, with GPU timestamps
• Draw calls: how many batches the frame was drawn in
• any sections you time with sysProfileStart / sysProfileEnd, with their ms and share of the frame

The figures are averages over the last second and update once a second. The same numbers can be read in code with b2dGetFrameTime, b2dGetGPUTime, b2dGetDrawCalls and sysProfileTime, whether the panel is showing or not.

View detailed documentation online



Example
b2dShowProfiler(True)          ; switch it on

If inpIsKeyHit(VKEY_F1) Then
    showing = Not showing
    b2dShowProfiler(showing)   ; or toggle it with a key
EndIf

BambooBasic © 2026 Michael Denathorn