AppleCake - Love Profiling

Showcase your libraries, tools and other projects that help your fellow love users.
Post Reply
User avatar
EngineerSmith
Prole
Posts: 38
Joined: Thu Dec 02, 2021 11:38 am
Contact:

AppleCake - Love Profiling

Post by EngineerSmith »

AppleCake is an extensive profiling library designed to profile multithreaded applications. It uses widely available Chromium's about://tracing for you to visualise the data.

AppleCake is a little over 2 years old now, and I have recently updated it to provide more features and better performance!

https://github.com/EngineerSmith/AppleCake
Full docs + examples: https://engineersmith.github.io/AppleCake-Docs/

Features
  • Profile how long code takes
  • Nested Profiling, so you can get more detailed information where time is spent
  • Multi-threaded profiling support
  • Mark timeless events when they happen
  • Track variables on a bar graph as they change
  • Profile Lua's memory usage in a bar graph
  • Disable for release easily across all threads
  • Recover Crashed data with ease
  • Switch to and from jprof easily, so you can try AppleCake out in your project

Check out the following URL for a full example of all of AppleCakes features https://engineersmith.github.io/AppleCa ... ample-full.
Basic example

Code: Select all

local appleCake = require("libs.AppleCake")(true) -- setting to false will remove it for the entire project
appleCake.beginSession("profile.json")

function love.quit()
	appleCake.endSession()
end

function love.load()
	local profile = appleCake.profile("love.load") -- simple profiling for single use functions
	-- ...
	profile:stop()
end

local updateProfile
function love.update(dt)
	updateProfile = appleCake.profileFunc({delta=dt}, updateProfile) -- reuse profile table to reduce overhead
	-- appleCake.profileFunc generates the name of the profile for you based on the function's name
	updateProfile:stop()
	appleCake.countMemory() -- add a bar chart of memory usage
end

function love.keypressed(_, key)
	appleCake.mark("Keypressed", "p", {key = key}) -- mark timeless events
end

local counter -- record the change in numeric variables as a bar chart
function love.draw()
	-- ...
	appleCake.counter("Draw calls", {memory=love.graphics.getStats().drawcalls}, counter)
end
Post Reply

Who is online

Users browsing this forum: No registered users and 6 guests