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

Add key to cycle through graph views #15

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all 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
24 changes: 18 additions & 6 deletions draw.lua
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,13 @@ draw.nextGraphMean = {
harmonic = "max",
}

draw.graphView = "both"
draw.nextGraphView = {
both = "time",
time = "memory",
memory = "both",
}

draw.flameGraphType = "time" -- so far: "time" or "memory"

local rootPath = {}
Expand Down Expand Up @@ -50,6 +57,7 @@ do
L, "Space: ", R, "Switch between 'time' and 'memory' mode.\n\n",

L, "Alt: ", R, "Cycle through graph averaging modes.\n\n",
L, "v: ", R, "Cycle through graph views.\n\n",
}
end

Expand Down Expand Up @@ -318,13 +326,17 @@ function love.draw()
end

if #frames > 1 then
lg.setLineWidth(1)
lg.setColor(const.timeGraphColor)
lg.line(graphs.time)
if draw.graphView == "time" or draw.graphView == "both" then
lg.setLineWidth(1)
lg.setColor(const.timeGraphColor)
lg.line(graphs.time)
end

lg.setLineWidth(2)
lg.setColor(const.memGraphColor)
lg.line(graphs.mem)
if draw.graphView == "memory" or draw.graphView == "both" then
lg.setLineWidth(2)
lg.setColor(const.memGraphColor)
lg.line(graphs.mem)
end
end

lg.setColor(const.textColor)
Expand Down
5 changes: 5 additions & 0 deletions main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,11 @@ function love.keypressed(key)
draw.graphMean = draw.nextGraphMean[draw.graphMean]
draw.notice("graph mean: " .. draw.graphMean)
end

if key == "v" then
draw.graphView = draw.nextGraphView[draw.graphView]
draw.notice("graph show: " .. draw.graphView)
end
end

local function pickFrameIndex(x)
Expand Down