This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| local utf8 = require("utf8") | |
| local utf8pos, utf8len = utf8.offset, utf8.len | |
| local sub = string.sub | |
| local max, min = math.max, math.min | |
| local posrelat = function(pos, len) | |
| if pos >= 0 then return pos end | |
| if -pos > len then return 0 end | |
| return pos + len + 1 | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| appleCake.setBuffer(true) | |
| local profile | |
| function love.update(dt) | |
| profile = appleCake.profileFunc(nil, profile) | |
| -- ... | |
| profile:stop() -- buffered, not sent to be saved | |
| end | |
| function love.draw() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| appleCake.flush() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| appleCake.setBuffer(false) -- default | |
| appleCake.setBuffer(true) | |
| -- Once true | |
| appleCake.flush() | |
| -- must be manually called for data to be pushed to the file saving thread |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| local jprof = appleCake.jprof | |
| jprof.enabled(true) | |
| jprof.enabled(false) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| appleCake.setThreadName("Server network") | |
| -- Sets the name for the current thread, making it easier to identity |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| appleCake.setName("EpicGame4004") | |
| -- sets the process and current threads name |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| appleCake.enable() -- enable everything | |
| appleCake.enable("all") | |
| appleCake.enable("none") -- disable everything | |
| appleCake.enable("profile") -- only enable profiles | |
| appleCake.enable("mark") -- only enable marks | |
| appleCake.enable("counter") -- only enable counters | |
| appleCake.enable(appleCake.enableLevels["profile"] + appleCake.enableLevels["mark"]) -- enable only profiles and marks, disable counters |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| local jprof = appleCake.jprof | |
| jprof.write() | |
| jprof.write("profile.json") | |
| jprof.write("profile-4/4/4-04:44.json") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| local jprof = appleCake.jprof | |
| jprof.push("frame") | |
| jprof.push("update") | |
| jprof.popAll() |