2017-07-27 02:41:07 +00:00
|
|
|
Profiler = require("piefiller")
|
2015-11-07 11:24:53 +00:00
|
|
|
ProfOn = true
|
2017-07-27 02:41:07 +00:00
|
|
|
drawRect = true
|
2015-11-07 11:24:53 +00:00
|
|
|
local Prof = Profiler:new()
|
|
|
|
function iterateSmall()
|
2017-07-27 02:41:07 +00:00
|
|
|
for i=1,1000 do
|
|
|
|
end
|
2015-11-07 11:24:53 +00:00
|
|
|
end
|
|
|
|
function iterateLarge()
|
2017-07-27 02:41:07 +00:00
|
|
|
for i=1,100000 do
|
|
|
|
|
|
|
|
end
|
2015-11-07 11:24:53 +00:00
|
|
|
end
|
|
|
|
function drawRectangles()
|
2017-07-27 02:41:07 +00:00
|
|
|
for i=1,100 do
|
2015-11-07 11:24:53 +00:00
|
|
|
love.graphics.setColor(255,0,0)
|
|
|
|
love.graphics.rectangle("line",i,i,i,i)
|
|
|
|
love.graphics.setColor(255,255,255)
|
2017-07-27 02:41:07 +00:00
|
|
|
end
|
|
|
|
end
|
2015-11-07 11:24:53 +00:00
|
|
|
function love.load()
|
|
|
|
end
|
|
|
|
function love.draw()
|
2017-07-27 02:41:07 +00:00
|
|
|
if drawRect then
|
2015-11-07 11:24:53 +00:00
|
|
|
drawRectangles()
|
2015-11-09 16:33:02 +00:00
|
|
|
Prof:detach()
|
2017-07-27 02:41:07 +00:00
|
|
|
end
|
|
|
|
if ProfOn then
|
2015-11-07 11:24:53 +00:00
|
|
|
Prof:draw({50})
|
2017-07-27 02:41:07 +00:00
|
|
|
end
|
2015-11-07 11:24:53 +00:00
|
|
|
end
|
|
|
|
function love.update(dt)
|
|
|
|
Prof:attach()
|
|
|
|
iterateSmall()
|
|
|
|
iterateLarge()
|
2017-07-27 02:41:07 +00:00
|
|
|
if drawRect then
|
2015-11-09 16:33:02 +00:00
|
|
|
Prof:detach(true)
|
2017-07-27 02:41:07 +00:00
|
|
|
else
|
2015-11-09 16:33:02 +00:00
|
|
|
Prof:detach()
|
2017-07-27 02:41:07 +00:00
|
|
|
end
|
2015-11-09 16:33:02 +00:00
|
|
|
local data = Prof:unpack()
|
2015-11-07 11:24:53 +00:00
|
|
|
end
|
|
|
|
function love.keypressed(key)
|
2017-07-27 02:41:07 +00:00
|
|
|
if key == "esc" then
|
2015-11-07 11:24:53 +00:00
|
|
|
ProfOn = not ProfOn
|
2017-07-27 02:41:07 +00:00
|
|
|
elseif key == ";" then
|
|
|
|
drawRect = not drawRect
|
|
|
|
end
|
2015-11-07 11:24:53 +00:00
|
|
|
Prof:keypressed(key)
|
|
|
|
end
|
|
|
|
function love.mousepressed(...)
|
|
|
|
Prof:mousepressed(...)
|
2017-07-27 02:41:07 +00:00
|
|
|
end
|