wowpedia
Main Menu


Returns the total time used for an addon.

time = GetAddOnCPUUsage(index or name)

Arguments

index
number - The index from 1 to GetNumAddOns(). Note that you cannot query Blizzard addons by index.
name
string - The name of the addon (as in TOC/folder filename), case insensitive.

Returns

time
number - The total time used by the specified AddOn, in milliseconds.

Details

Running this code will show the addon using 300-350ms CPU time:
 e=debugprofilestop()+500; while debugprofilestop()<e do end
 -- we're spending a lot of time simply calling the API!
But running THIS code will show the addon using much closer to 500ms CPU time:
 e=debugprofilestop()+500; while debugprofilestop()<e do 
   for i=1,1000 do end
 end
However, in both cases, :GetFrameCPUUsage() on the addon's frame will report 500ms used.

Patch changes

Dragonflight Patch 10.1.0 (2023-05-02): Will now raise an error if a secure addon is queried.