Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Coloring Spike for Profiling #4852

Merged
merged 5 commits into from
Feb 4, 2024
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion WeakAuras/Profiling.lua
Original file line number Diff line number Diff line change
Expand Up @@ -316,14 +316,32 @@ local function PrintOneProfile(popup, name, map, total)
if map.count ~= 0 then
popup:AddText(name .. " ERROR: count is not zero:" .. " " .. map.count)
end

local percent = ""
if total then
percent = ", " .. string.format("%.2f", 100 * map.elapsed / total) .. "%"
end

local spikeInfo = ""

if map.spike then
spikeInfo = string.format("(%.2fms)", map.spike)
local color
local r, g, b, a

if map.spike < 2 then
r, g, b, a = WeakAuras.GetHSVTransition(map.spike / 2, 0, 1, 0, 1, 1, 1, 0, 1)
elseif map.spike >= 2 and map.spike < 3 then
r, g, b, a = WeakAuras.GetHSVTransition((map.spike - 2) , 1, 1, 0, 1, 1, 0.65, 0, 1)
else
r, g, b, a = WeakAuras.GetHSVTransition(1, 1, 0, 0, 1, 1, 0, 0, 1)
mrbuds marked this conversation as resolved.
Show resolved Hide resolved
end

color = string.format("|cff%02x%02x%02x", r * 255, g * 255, b * 255)
mrbuds marked this conversation as resolved.
Show resolved Hide resolved
spikeInfo = string.format("%s(%.2fms)|r", color, map.spike)
else
spikeInfo = "" -- handle no map.spike
mrbuds marked this conversation as resolved.
Show resolved Hide resolved
end

popup:AddText(string.format("%s |cff999999%.2fms%s %s|r", name, map.elapsed, percent, spikeInfo))
end

Expand Down