# Stats

Roblox Engine API class from Roblox Studio 0.744.0.7441077 (version-7aaa6838d36c4448).

- Inherits from, nearest first: [Instance](https://rapi.sleaze.dev/classes/Instance.md), [Object](https://rapi.sleaze.dev/classes/Object.md)
- Tags: Not creatable, Service
- Memory category: Instances
- HTML page: https://rapi.sleaze.dev/classes/Stats/
- Roblox documentation: https://create.roblox.com/docs/reference/engine/classes/Stats

Performance metrics for a game.

## Properties

### ContactsCount

```luau
Stats.ContactsCount: number
```

- Tags: Read only

A measurement of how many parts are currently in contact with one another.

### DataReceiveKbps

```luau
Stats.DataReceiveKbps: number
```

- Tags: Read only

In a networked game, this describes roughly how many kilobytes of data are being received by the current instance, per second.

### DataSendKbps

```luau
Stats.DataSendKbps: number
```

- Tags: Read only

In a networked game, this describes roughly how many kilobytes of data are being sent by the current instance, per second.

### FrameTime

```luau
Stats.FrameTime: number
```

- Tags: Read only

A measurement of how long it takes for the engine to process all tasks required to render a frame.

### HeartbeatTime

```luau
Stats.HeartbeatTime: number
```

- Tags: Read only

A measurement of the total amount of time it takes for the server to update its task scheduler jobs in seconds.

### InstanceCount

```luau
Stats.InstanceCount: number
```

- Tags: Read only

A measurement of how many [`Instance`](https://rapi.sleaze.dev/classes/Instance.md) are currently in memory.

### MemoryTrackingEnabled

```luau
Stats.MemoryTrackingEnabled: boolean
```

- Tags: Read only

An indication of whether memory tracking is enabled. This is guaranteed to be unchanged until the next time the Client is started.

### MovingPrimitivesCount

```luau
Stats.MovingPrimitivesCount: number
```

- Tags: Read only

A measurement of how many physically simulated components are currently moving in the game world.

### PhysicsReceiveKbps

```luau
Stats.PhysicsReceiveKbps: number
```

- Tags: Read only

In a networked game, this describes roughly how many kilobytes of physics data are being received by the current instance, per second.

### PhysicsSendKbps

```luau
Stats.PhysicsSendKbps: number
```

- Tags: Read only

In a networked game, this describes roughly how many kilobytes of physics data are being sent by the current instance, per second.

### PhysicsStepTime

```luau
Stats.PhysicsStepTime: number
```

- Tags: Read only

A measurement of how long it takes for the physics engine to update its current state.

### PrimitivesCount

```luau
Stats.PrimitivesCount: number
```

- Tags: Read only

A measurement of how many physically simulated components currently exist in the game world.

### RenderCPUFrameTime

```luau
Stats.RenderCPUFrameTime: number
```

- Tags: Read only

A measurement of how long it takes for the CPU to process all of its rendering tasks for a frame.

### RenderGPUFrameTime

```luau
Stats.RenderGPUFrameTime: number
```

- Tags: Read only

A measurement of how long it takes for the GPU to process all of its tasks required to render a frame.

### SceneDrawcallCount

```luau
Stats.SceneDrawcallCount: number
```

- Tags: Read only

A measurement of the number of draw calls made by the game's current scene.

### SceneTriangleCount

```luau
Stats.SceneTriangleCount: number
```

- Tags: Read only

A measurement of the number of triangles rendered by the game's current scene.

### ShadowsDrawcallCount

```luau
Stats.ShadowsDrawcallCount: number
```

- Tags: Read only

A measurement of the number of draw calls being made for shadows by the game's current scene.

### ShadowsTriangleCount

```luau
Stats.ShadowsTriangleCount: number
```

- Tags: Read only

A measurement of the number of triangles rendered as shadows in the game's current scene.

### UI2DDrawcallCount

```luau
Stats.UI2DDrawcallCount: number
```

- Tags: Read only

A measurement of the number of 2D draw calls made for UI elements in the game's current scene.

### UI2DTriangleCount

```luau
Stats.UI2DTriangleCount: number
```

- Tags: Read only

A measurement of the number of triangles that are being rendered for 2D UI elements in the game's current scene.

### UI3DDrawcallCount

```luau
Stats.UI3DDrawcallCount: number
```

- Tags: Read only

A measurement of the number of 3D draw calls made for UI elements in the game's current scene.

### UI3DTriangleCount

```luau
Stats.UI3DTriangleCount: number
```

- Tags: Read only

A measurement of the number of triangles being rendered for 3D UI elements in the game's current scene.

### HeartbeatTimeMs

```luau
Stats.HeartbeatTimeMs: number
```

- Tags: Deprecated, Read only

**Deprecated:** Use [`Stats.HeartbeatTime`](https://rapi.sleaze.dev/classes/Stats.md) instead.

A measurement of the total amount of time it takes long it takes for Roblox to update all of its task scheduler jobs, in milliseconds.

### PhysicsStepTimeMs

```luau
Stats.PhysicsStepTimeMs: number
```

- Tags: Deprecated, Read only

**Deprecated:** Use [`Stats.PhysicsStepTime`](https://rapi.sleaze.dev/classes/Stats.md) instead.

A measurement of how long it takes for the physics engine to update its current state, in milliseconds. If this value is high, then it means the game instance is under stress from the physics simulations taking place.

## Methods

### GetBrowserTrackerId

```luau
Stats:GetBrowserTrackerId(): string
```

- Tags: Roblox script security

### GetHarmonyQualityLevel

```luau
Stats:GetHarmonyQualityLevel(): number
```

- Tags: Capabilities: InternalTest

Internal-only. Returns the engine's current dynamic-quality level as a score normalized from `0` to `100`.

Returns: The current dynamic-quality level, normalized from `0` (lowest quality) to `100` (highest quality).

### GetMemoryCategoryNames

```luau
Stats:GetMemoryCategoryNames(): { any }
```

- Tags: Capabilities: InternalTest

Internal-only. Returns an array of the names of every developer memory category the engine tracks.

Returns: An array of strings, one per tracked memory category, ordered to match the values returned by [`Stats:GetMemoryUsageMbAllCategories()`](https://rapi.sleaze.dev/classes/Stats.md).

### GetMemoryUsageMbAllCategories

```luau
Stats:GetMemoryUsageMbAllCategories(): { any }
```

- Tags: Capabilities: InternalTest

Returns the number of megabytes that are being consumed by all available categories, or an empty array if [`MemoryTrackingEnabled`](https://rapi.sleaze.dev/classes/Stats.md) is `false`.

Returns: An array of numbers in which each entry is the memory, in megabytes, consumed by one memory category, ordered to match the categories returned by [`Stats:GetMemoryCategoryNames()`](https://rapi.sleaze.dev/classes/Stats.md). Returns an empty array if [`MemoryTrackingEnabled`](https://rapi.sleaze.dev/classes/Stats.md) is `false`.

### GetMemoryUsageMbAllCategoriesFiltered

```luau
Stats:GetMemoryUsageMbAllCategoriesFiltered(dmId: number, vmClass: number): { any }
```

- Tags: Capabilities: InternalTest

### GetMemoryUsageMbFiltered

```luau
Stats:GetMemoryUsageMbFiltered(dmId: number, vmClass: number): number
```

- Tags: Capabilities: InternalTest

### GetMemoryUsageMbForTag

```luau
Stats:GetMemoryUsageMbForTag(tag: Enum.DeveloperMemoryTag): number
```

Returns the number of megabytes that are being consumed in the specified `DeveloperMemoryTag` category, or `0` if [`MemoryTrackingEnabled`](https://rapi.sleaze.dev/classes/Stats.md) is `false`.

Parameters:

- `tag`: The `DeveloperMemoryTag` memory category to measure.

Returns: The memory, in megabytes, consumed by the given `DeveloperMemoryTag` category, or `0` if [`MemoryTrackingEnabled`](https://rapi.sleaze.dev/classes/Stats.md) is `false`.

### GetPaginatedMemoryByTexture

```luau
Stats:GetPaginatedMemoryByTexture(queryType: Enum.TextureQueryType, pageIndex: number, pageSize: number): { [string]: any }
```

- Tags: Yields, Roblox script security

### GetTotalMemoryUsageMb

```luau
Stats:GetTotalMemoryUsageMb(): number
```

Returns the total amount of memory being consumed by the current game session, in megabytes.

Returns: The total memory, in megabytes, used by the current game session, as reported by the operating system.

### ResetHarmonyMemoryTarget

```luau
Stats:ResetHarmonyMemoryTarget()
```

- Tags: Capabilities: InternalTest

Internal-only. Restores the performance-control system's memory budget to the values in effect before [`Stats:SetHarmonyMemoryTarget()`](https://rapi.sleaze.dev/classes/Stats.md) was called.

### SetHarmonyMemoryTarget

```luau
Stats:SetHarmonyMemoryTarget(targetMB: number)
```

- Tags: Capabilities: InternalTest

Internal-only. Overrides the performance-control system's memory budget with a target value, in megabytes, for testing.

Parameters:

- `targetMB`: The memory budget to impose on the performance-control system, in megabytes.

## Inherited members

- From [Instance](https://rapi.sleaze.dev/classes/Instance.md): `Archivable`, `archivable`, `Attributes`, `AttributesReplicate`, `AttributesSerialize`, `HistoryId`, `Name`, `Parent`, `PredictionMode`, `PropertyStatusStudio`, `RobloxLocked`, `SerializedOverrides`, `SourceAssetId`, `Tags`, `UniqueId`, `numExpectedDirectChildren`, `DataCost`, `Capabilities`, `DefinesCapabilities`, `IsInSandbox`, `Sandboxed`, `AddTag`, `ClearAllChildren`, `Clone`, `Destroy`, `FindFirstAncestor`, `FindFirstAncestorOfClass`, `FindFirstAncestorWhichIsA`, `FindFirstChild`, `FindFirstChildOfClass`, `FindFirstChildWhichIsA`, `FindFirstDescendant`, `GetActor`, `GetAttribute`, `GetAttributeChangedSignal`, `GetAttributes`, `GetChildren`, `GetDebugId`, `GetDescendants`, `GetFullName`, `GetStyled`, `GetStyledPropertyChangedSignal`, `GetTags`, `HasTag`, `IsAncestorOf`, `IsDescendantOf`, `IsPropertyModified`, `QueryDescendants`, `RemoveTag`, `ResetPropertyToDefault`, `SetAttribute`, `WaitForChild`, `Remove`, `children`, `clone`, `destroy`, `findFirstChild`, `getChildren`, `isDescendantOf`, `remove`, `AncestryChanged`, `AttributeChanged`, `ChildAdded`, `ChildRemoved`, `DescendantAdded`, `DescendantRemoving`, `Destroying`, `StyledPropertiesChanged`, `childAdded`
- From [Object](https://rapi.sleaze.dev/classes/Object.md): `ClassName`, `className`, `GetPropertyChangedSignal`, `IsA`, `isA`, `Changed`
