[Lib-Tool] Multi-partite Performance Graph

Showcase your libraries, tools and other projects that help your fellow love users.
Post Reply
User avatar
zorg
Party member
Posts: 3436
Joined: Thu Dec 13, 2012 2:55 pm
Location: Absurdistan, Hungary
Contact:

[Lib-Tool] Multi-partite Performance Graph

Post 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 123 times
mppg.lua
multi-partite performance graph toolib
(7.5 KiB) Downloaded 92 times
Me and my stuff :3True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.
User avatar
Roland_Yonaba
Inner party member
Posts: 1563
Joined: Tue Jun 21, 2011 6:08 pm
Location: Ouagadougou (Burkina Faso)
Contact:

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

Post by Roland_Yonaba »

Very nice!
Post Reply

Who is online

Users browsing this forum: No registered users and 64 guests