# C_AddOnProfiler: World of Warcraft Forever API

Forever 1.60.1 (70959), Interface 16001, Lua 5.1, from Blizzard's own API documentation. Page: https://wowaddons.gg/forever-api/C_AddOnProfiler

## Functions

### C_AddOnProfiler.AddMeasuredCallEvent

```lua
C_AddOnProfiler.AddMeasuredCallEvent(name)
```

Adds a measured event to any ongoing measured calls. If no such calls are currently taking place, this function does nothing.

Arguments:
- `name`: stringView. User-defined string describing the measured event. This should be kept under 48 bytes to avoid memory allocations.

### C_AddOnProfiler.AddPerformanceMessageShown

```lua
C_AddOnProfiler.AddPerformanceMessageShown(msg)
```

Internal API for telemetry.

Arguments:
- `msg`: AddOnPerformanceMessage

### C_AddOnProfiler.CheckForPerformanceMessage

```lua
msg = C_AddOnProfiler.CheckForPerformanceMessage()
```

Optimized check for determining if AddOns are severely impacting UI performance.

May return nothing.

Returns:
- `msg`: AddOnPerformanceMessage

### C_AddOnProfiler.GetAddOnMetric

```lua
result = C_AddOnProfiler.GetAddOnMetric(name, metric)
```

Gets an AddOn profiler value - all times returned are in milliseconds.

Arguments:
- `name`: cstring
- `metric`: AddOnProfilerMetric

Returns:
- `result`: number

### C_AddOnProfiler.GetApplicationMetric

```lua
result = C_AddOnProfiler.GetApplicationMetric(metric)
```

Overall profiling data for the entire application (not just the UI)

Arguments:
- `metric`: AddOnProfilerMetric

Returns:
- `result`: number

### C_AddOnProfiler.GetOverallMetric

```lua
result = C_AddOnProfiler.GetOverallMetric(metric)
```

Overall profiling data for all addons

Arguments:
- `metric`: AddOnProfilerMetric

Returns:
- `result`: number

### C_AddOnProfiler.GetTicksPerSecond

```lua
frequency = C_AddOnProfiler.GetTicksPerSecond()
```

Returns the number of profiling clock ticks that occur within a single real-time second.

Returns:
- `frequency`: BigInteger

### C_AddOnProfiler.GetTopKAddOnsForMetric

```lua
results = C_AddOnProfiler.GetTopKAddOnsForMetric(metric, k)
```

Gets top K AddOns for a given metric.

Arguments:
- `metric`: AddOnProfilerMetric
- `k`: number

Returns:
- `results`: AddOnProfilerResult[]

### C_AddOnProfiler.IsEnabled

```lua
enabled = C_AddOnProfiler.IsEnabled()
```

AddOn profiler will be enabled for all users, but this will return false if it ever isn't

Returns:
- `enabled`: bool

### C_AddOnProfiler.MeasureCall

```lua
results, returns = C_AddOnProfiler.MeasureCall(func, arguments)
```

Performs a profiled measurement of a single function call with any supplied arguments.

Arguments:
- `func`: LuaValueVariant
- `arguments`: LuaValueVariant

Returns:
- `results`: AddOnProfilerCallResults
- `returns`: LuaValueVariant

## Tables

### AddOnPerformanceMessage (structure)

- `type`: AddOnPerformanceMessageType
- `metric`: AddOnProfilerMetric
- `addOnName`: string, may be nil
- `metricValue`: number
- `thresholdValue`: number

### AddOnProfilerCallEvent (structure)

- `name`: string. User-defined string describing the measured event.
- `allocatedBytes`: BigUInteger. Snapshot of the allocated byte count when this event was recorded.
- `deallocatedBytes`: BigUInteger. Snapshot of the deallocated byte count when this event was recorded.
- `elapsedMilliseconds`: number. Snapshot of the elapsed milliseconds when this event was recorded.
- `elapsedTicks`: BigInteger. Snapshot of the elapsed tick count when this event was recorded.

### AddOnProfilerCallResults (structure)

- `elapsedMilliseconds`: number. Total number of milliseconds spent executing the function.
- `elapsedTicks`: BigInteger. Total number of profiling clock ticks spent executing the function.
- `allocatedBytes`: BigUInteger. Total number of bytes allocated during call execution.
- `deallocatedBytes`: BigUInteger. Total number of bytes deallocated during call execution.
- `events`: AddOnProfilerCallEvent[]. Events recorded by any AddMeasuredCallEvent calls that took place during function execution.

### AddOnProfilerResult (structure)

- `addOnName`: cstring
- `metricValue`: number

---
Make an addon with your AI: tell it "Read https://wowaddons.gg/agents.md, then make me a World of Warcraft Forever addon that …, try it with me in the game, and publish it."
