Skip to content
Brandon Blanker Lim-it edited this page Sep 27, 2021 · 2 revisions
Table of Contents

Overview

The Slab API offers functions that track the performance of desired sections of code. With these functions coupled together with the debug performance window, end-users will be able to see bottlenecks located within their code base quickly. To display the performance window, call the SlabDebug.Performance function.

API

Below is a list of functions associated with the Stats API.

BeginStat

Starts the timer for the specific stat in the given category.

Parameter Type Description
Name String The name of the stat to capture.
Category String The category this stat belongs to.
Return Description
Number The handle identifying this stat capture.

EndStat

Ends the timer for the stat assigned to the given handle.

Parameter Type Description
Number The handle identifying a BeginStat call.

EnableStats

Sets the enabled state of the stats system. The system is disabled by default.

Parameter Type Description
Enable Boolean The new state of the states system.

IsStatsEnabled

Query whether the stats system is enabled or disabled.

Return Description
Boolean Returns whether the stats system is enabled or disabled.

FlushStats

Resets the stats system to an empty state.

GetStats

Get the love.graphics.getStats of the Slab. Stats.SetEnabled(true) must be previously set to enable this. Must be called in love.draw (recommended at the end of draw)

Return Description
Table Returns a table similar to love.graphics.getStats() of Slabs stats.

CalculateStats

Calculate the passed love.graphics.getStats table of love by subtracting the stats of Slab. Stats.SetEnabled(true) must be previously set to enable this. Must be called in love.draw (recommended at the end of draw). For code example, check issue #91

Parameter Type Description
LoveStats Table table of love.graphics.getStats().
Return Description
Table Returns a modified LoveStats table (subtracted the stats used by Slab).
Clone this wiki locally