-
Notifications
You must be signed in to change notification settings - Fork 0
API Performance
Keith McGahey edited this page Apr 8, 2026
·
2 revisions
Performance monitoring utilities for apps.
Starts timing a frame. Call at the beginning of your game loop.
- Parameters: None
- Returns: None
while true do
picocalc.perf.beginFrame()
-- Game logic
picocalc.perf.endFrame()
endEnds timing a frame and updates FPS calculation. Call at the end of your game loop.
- Parameters: None
- Returns: None
Returns the current FPS, averaged over the last 30 frames.
- Parameters: None
- Returns: (number) Frames per second
local fps = picocalc.perf.getFPS()Returns the last frame's duration in milliseconds.
- Parameters: None
- Returns: (number) Milliseconds
local ms = picocalc.perf.getFrameTime()Convenience function to draw the FPS counter on screen. Color-coded: green ≥55 FPS, yellow ≥30, red <30.
-
Parameters:
-
x(number, optional): X coordinate. Defaults to 250 (top-right). -
y(number, optional): Y coordinate. Defaults to 8.
-
- Returns: None
picocalc.perf.drawFPS() -- Draw at default positionSet target frame rate for automatic frame pacing. When set, endFrame() will sleep to maintain the target rate. Pass 0 to disable frame limiting.
-
Parameters:
-
fps(number): Target frames per second (0= unlimited)
-
- Returns: None
picocalc.perf.setTargetFPS(30) -- Cap at 30 FPS
picocalc.perf.setTargetFPS(0) -- Disable frame limiting