Looking through the forums, i saw a post in a thread having a screenshot and code snippet for a pretty simple minecraft-like performance graph.
I thought i'd make it a bit more interesting, so (with the approval of the original coder) here's my first released library, a multipartite performance graph.
What this is, is that you can define multiple points to benchmark code execution times, and it will be visualized by a neat graph with a few options. Note: Not having multiple benchmark points "overlap" and measure possibly overlapping code segment exec. times is left as an excercise to the reader.
The basics are very simple:
Code: Select all
-- in love.load or similar
perfGraph = require "mppg"
perfGraph.add('logic',{0,0,255}) -- adding benchmarks
perfGraph.add('render',{0,255,0})
-- wherever you want to start a benchmark
perfGraph.start('logic')
-- wherever you want it to stop; it will calculate the difference in time between this point and when it was last started.
perfGraph.stop('logic')
-- finally, in love.draw, render the graph
perfGraph.draw() -- no parameter -> draw all of the benchmarks