Page 1 of 1

[Lib-Tool] Multi-partite Performance Graph

Posted: Thu Aug 21, 2014 9:08 pm
by zorg
Hi everyone!

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
Haven't had time to put it up onto github yet, so have a demo .love and the lib .lua:
mppg.love
multi-partite performance graph demo
(4.06 KiB) Downloaded 124 times
mppg.lua
multi-partite performance graph toolib
(7.5 KiB) Downloaded 92 times

Re: [Lib-Tool] Multi-partite Performance Graph

Posted: Thu Aug 21, 2014 10:07 pm
by Roland_Yonaba
Very nice!