Shows or hides the built-in profiler panel.
Takes enable (True to show, False to hide).
2D Overlay
Parameters & Returns
Parameters
enableInt
Returns
Void
Quick Summary
Shows or hides the built-in profiler panel.
Takes enable (True to show, False to hide).
Technical Exegesis...
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.
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. On the desktop this is measured exactly; on the web it is an estimate (marked ~): how long the GPU takes to finish the frame after it is sent
- 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.
Example
Example.bam
b2dShowProfiler(True) ; switch it on
If inpIsKeyHit(VKEY_F1) Then
showing = Not showing
b2dShowProfiler(showing) ; or toggle it with a key
EndIf