tags:

views:

65

answers:

1

I'm no good at math. :) Is this right?

I'm accumulating all CPU seconds, and I need to find what percentage the addon's CPU time is from the total.

function PluginResources.GetTotalCPU(addon)
    UpdateAddOnCPUUsage()
    local totalCPU = 0
    for i=1, GetNumAddOns() do
        totalCPU = totalCPU + (GetAddOnCPUUsage(i) )
    end 
    local addonUsage = GetAddOnCPUUsage(addon)
    local usage = totalCPU / addonUsage
    return usage
end
+2  A: 

Try usage = addonUsage / totalCPU.

lhf
I think that's it. Thanks.
Scott