MicroProfiler

The MicroProfiler (shortened as profiler) is a built-in profiling tool of the Roblox's engine, mainly used for optimizing a place in Roblox Studio. The profiler records information about Task Scheduler processes in real-time. The interface can be toggled on or off by pressing . Recording can be paused by pressing for reading individual tasks.
== Profiler ==
There are three main features of the profiler: a menu bar at the top of the interface, a bar graph below it consisting of bars representing frames, and a timeline consisting of frames, covering the rest of the interface.
When not paused, the profiler records each frame which is represented by a bar in the bar graph, in which bars flow to the left. An orange bar represents the frame's processing time, where a long processing time results in a taller bar while a short processing time results in a shorter bar.
While paused, the timeline is visible which shows all of the tasks recorded by the profiler. Clicking on a frame in the bar graph will zoom into that frame in the timeline. The timeline contains tasks represented as labels with different colors representing types of task. Longer labels indicate longer processing time. Labels appearing directly underneath another label indicate that a task is performed during another task. Right-clicking on a label will zoom into the duration of the label.
=== Activation ===
The profiler is turned off by default, but will turn on when the interface is accessed ().
=== Line graphs ===
Left-clicking on a label will add it to a line graph shown at the bottom right of the interface, which show the time the task is taking each frame. Multiple labels can be added. Right-clicking on the line graph will clear it.
=== Threads ===
The profiler records three types of threads (indicated on the left of the interface):
*Main - Threads of this type perform general tasks and also coordinate the other threads.
*TSMk2 worker (simply known as worker) - Threads of this type assists the main thread with networking, physics, pathfinding and parallel code. Multiple are used depending on the number of processor cores.
*GPU - Threads of this type communicate with the graphics processing unit (GPU) of the device.
Each thread processes sequences of tasks, which are put in the same horizontal space as the thread in the timeline.
=== Modes ===
There are also other features that can be viewed in different modes of the profiler. A mode can be selected through the menu bar. The available modes are:
;Detailed
:Shows the frames and the timeline.
;Timers
:Shows a list of all labels found in the timeline as well as their processing times and counts of how many labels of the same type in the timeline.
;Counters
:Shows various stats of the engine. The stats are not affected when the profiler is paused.
;Frame
:Shows only both the menu bar and the frames.
;Hidden
:Shows only the menu bar.
;Off
:Hides the interface altogether.
=== Groups ===
Groups of labels can be filtered through the Groups menu in the menu bar. There are a few groups which relate to game development:
*GPU - The Scene label indicate the processing time to render the entire scene.
**Id_Opaque - Process of opaque triangles in the scene, usually of parts with Transparency set to zero.
**Id_Transparent - Process of transparent triangles of objects in the scene including parts with Transparency set to a value above zero, particles, and GUI objects in a or with AlwaysOnTop property set to false.
**Id_Screen - Process of GUI triangles.
**Id_AlwaysOnTop - Process of GUI triangles of objects that are descendants of a or with AlwaysOnTop property set to true.
**Id_Terrain - Process of triangles of the mesh.
**Id_Water - Process of triangles of the Water mesh.
**Id_Glass - Process of triangles of parts of the Glass material with Transparency set to a value above zero.
**Id_Decal - Process of triangles of s or s.
*Lua - Any Lua process:
**$Script - Process of threads run by a script.
== Custom profiling ==
Roblox has two functions of the debug library: debug.profilebegin which starts a label followed by debug.profileend which ends the label (yielding will also end the label as well as other labels). A string must be passed to debug.profilebegin in order to name the label.
== Mobile devices ==
MicroProfiler can be enabled for a mobile device through the Settings tab in the menu. Once enabled, the network IP address of the device is displayed followed by a port number. This address can be accessed in a web browser of a computer connected to the same network which will lead to the interface.
== External links ==
*Using MicroProfiler on Roblox Creator Documentation
*MicroProfiler on Roblox Developer Hub
== See also ==
*Developer Console
Category:Game development
Category:Experience features