# llGetSimStats

*LSL function*

```lsl
float float llGetSimStats(integer stat_type);
```

- `integer stat_type`: SIM_STAT_* flag of the statistic to retrieve.

- Returns: `float`
- Energy: 10

Returns a float containing the value of the requested region statistic specified by stat_type.

Returns a [float](https://wiki.secondlife.com/wiki/float) that is the requested statistic.

```lsl title="How to use" frame="terminal"
float result = llGetSimStats(0);
```

## Specification

| Name |  | Possible Return | Description |
| --- | --- | --- | --- |
| [SIM_STAT_PCT_CHARS_STEPPED](/constants/SIM_STAT_PCT_CHARS_STEPPED/) | 0 | \[0.0, 100.0\] | The % of pathfinding characters updated each frame, averaged over the last minute. The value corresponds to the "Characters Updated" stat in the viewer's Statistics Bar. |
| [SIM_STAT_PHYSICS_FPS](/constants/SIM_STAT_PHYSICS_FPS/) | 1 | \[0.0, Inf\] | Physics simulation FPS. |
| [SIM_STAT_AGENT_UPDATES](/constants/SIM_STAT_AGENT_UPDATES/) | 2 | \[0.0, Inf\] | Agent updates per second. |
| [SIM_STAT_FRAME_MS](/constants/SIM_STAT_FRAME_MS/) | 3 | \[0.0, Inf\] | Total frame time. |
| [SIM_STAT_NET_MS](/constants/SIM_STAT_NET_MS/) | 4 | \[0.0, Inf\] | Time spent in 'network' segment of simulation frame. |
| [SIM_STAT_OTHER_MS](/constants/SIM_STAT_OTHER_MS/) | 5 | \[0.0, Inf\] | Main simulation segment of frame, encapsulating task, script and misc. updates. |
| [SIM_STAT_PHYSICS_MS](/constants/SIM_STAT_PHYSICS_MS/) | 6 | \[0.0, Inf\] | Time spent in 'physics' segment of simulation frame. |
| [SIM_STAT_AGENT_MS](/constants/SIM_STAT_AGENT_MS/) | 7 | \[0.0, Inf\] | Time spent in 'agent' segment of simulation frame. |
| [SIM_STAT_IMAGE_MS](/constants/SIM_STAT_IMAGE_MS/) | 8 | \[0.0, Inf\] | Time spent in 'image' segment of simulation frame. |
| [SIM_STAT_SCRIPT_MS](/constants/SIM_STAT_SCRIPT_MS/) | 9 | \[0.0, Inf\] | Time spent in 'script' segment of simulation frame. |
| [SIM_STAT_AGENT_COUNT](/constants/SIM_STAT_AGENT_COUNT/) | 10 | \[0.0, Inf\] | Number of agents in region. |
| [SIM_STAT_CHILD_AGENT_COUNT](/constants/SIM_STAT_CHILD_AGENT_COUNT/) | 11 | \[0.0, Inf\] | Number of child (neighboring) agents in region. |
| [SIM_STAT_ACTIVE_SCRIPT_COUNT](/constants/SIM_STAT_ACTIVE_SCRIPT_COUNT/) | 12 | \[0.0, Inf\] | Number of active scripts in region. |
| [SIM_STAT_PACKETS_IN](/constants/SIM_STAT_PACKETS_IN/) | 13 | \[0.0, Inf\] | Average packets in per second. |
| [SIM_STAT_PACKETS_OUT](/constants/SIM_STAT_PACKETS_OUT/) | 14 | \[0.0, Inf\] | Average packets out per second. |
| [SIM_STAT_ASSET_DOWNLOADS](/constants/SIM_STAT_ASSET_DOWNLOADS/) | 15 | \[0.0, Inf\] | Pending asset download count. |
| [SIM_STAT_ASSET_UPLOADS](/constants/SIM_STAT_ASSET_UPLOADS/) | 16 | \[0.0, Inf\] | Pending asset upload count. |
| [SIM_STAT_UNACKED_BYTES](/constants/SIM_STAT_UNACKED_BYTES/) | 17 | \[0.0, Inf\] | Total unacknowledged bytes. |
| [SIM_STAT_PHYSICS_STEP_MS](/constants/SIM_STAT_PHYSICS_STEP_MS/) | 18 | \[0.0, Inf\] | Average physics step time. |
| [SIM_STAT_PHYSICS_SHAPE_MS](/constants/SIM_STAT_PHYSICS_SHAPE_MS/) | 19 | \[0.0, Inf\] | Average physics 'shape' segment update time. |
| [SIM_STAT_PHYSICS_OTHER_MS](/constants/SIM_STAT_PHYSICS_OTHER_MS/) | 20 | \[0.0, Inf\] | Average physics 'other' segment update time. |
| [SIM_STAT_SCRIPT_EPS](/constants/SIM_STAT_SCRIPT_EPS/) | 21 | \[0.0, Inf\] | Script events per second. |
| [SIM_STAT_SPARE_MS](/constants/SIM_STAT_SPARE_MS/) | 22 | \[0.0, Inf\] | Spare time left after frame. |
| [SIM_STAT_SLEEP_MS](/constants/SIM_STAT_SLEEP_MS/) | 23 | \[0.0, Inf\] | Time spent sleeping. |
| [SIM_STAT_IO_PUMP_MS](/constants/SIM_STAT_IO_PUMP_MS/) | 24 | \[0.0, Inf\] | PumpIO time. |
| [SIM_STAT_SCRIPT_RUN_PCT](/constants/SIM_STAT_SCRIPT_RUN_PCT/) | 25 | \[0.0, 100.0\] | Percent of scripts run during frame. |
| [SIM_STAT_AI_MS](/constants/SIM_STAT_AI_MS/) | 26 | \[0.0, Inf\] | Time spent on AI step. |

## Examples

<details open>
<summary>Example 1</summary>

```lsl
default
{
    touch_start(integer num_detected)
    {
        float pct_chars_stepped = llGetSimStats(SIM_STAT_PCT_CHARS_STEPPED);
        llSay(0,
            "The percentage of pathfinding characters updated each frame was "
            + (string)pct_chars_stepped + "averaged over the last minute. The "
            + "value corresponds to the 'Characters Updated' stat in the "
            + "viewer's Statistics Bar. ");
    }
}
```

</details>

## History

Date of Release [26/10/2012](https://wiki.secondlife.com/wiki/Release_Notes/Second_Life_Server/12#12-10-26-266333)

## See also

### Functions

- [llAbs](/functions/llAbs/) — [integer](https://wiki.secondlife.com/wiki/integer) version of [llFabs](/functions/llFabs/)

---

*Source: [LlGetSimStats](https://wiki.secondlife.com/wiki/LlGetSimStats) on the Second Life Wiki. Content from the Second Life Wiki articles LlGetSimStats (revision 1194256, 2015-01-22) and Template:LSL Constants/llGetSimStats (revision 1213252, 2023-02-03), CC BY-SA 3.0.*

---

From lsl.dev: https://lsl.dev/functions/llGetSimStats/
