Graphical profiler for Love2D 0.10.2
- require the file:
piefiller = require("piefiller")
- make a new instance of piefiller
Pie = piefiller:new()
- attach the piefiller to the part of your application that you want to monitor, it can be whatever but I suggest calling it in love.update or love.draw as this is what piefiller is all about.
function love.update()
Pie:attach()
-- do something
Pie:detach()
end
- draw the output in your draw function and give event hooks for your pie.
function love.draw()
Pie:draw()
end
function love.keypressed(...)
Pie:keypressed(...)
end
function love.mousepressed(...)
Pie:mousepressed(...)
end
- When you get sufficient output press the "P" key to output to file.
r = resets the pie
up = decreases depth
down = increases depth
, = decreases step size
. = increases step size
s = shortens the names displayed
c = hides/shows hidden processes
p = saves to file called "Profile" and opens directory for you
Modes available:
reset
increase_depth
decrease_depth
increase_step_size
decrease_step_size
shorten_names
show_hidden
save_to_file
To redefine only one of the keys:
piefiller:setKey(mode,key)
example:
piefiller:setKey("increase_depth","up")
To redefine all of the keys:
table = {
"increase_depth" = "up"
}
piefiller:setKey(table)
If you wish to interpret the data on your own use piefiller:unpack().
Output is a table as such:
data = {
items = {
{
name,
line_defined,
current_line,
source,
time_taken,
percentage,
caller,
}
},
about = {
depth,
step,
totalTime,
},
}
The best depth to search for is 2 and 3.
When used in large applications the output is difficult to read, however printing to file resolves this issue.
Make sure that text does not overlay.