project-topaz / topaz

Server emulator for FFXI
Other
159 stars 224 forks source link

Tracy Profiling #1432

Closed zach2good closed 3 years ago

zach2good commented 3 years ago

This is the power of CMake!

Build with TRACY_ENABLE to turn on the profiling, otherwise, everything will get stripped away and has no effect on the build.

This PR adds support for the Tracy client in topaz_game. Once the game is built and running, you can connect the server to it to see the beautiful stats in realtime:

image

We are hardcoded to v0.7.3, different versions of client and server are not compatible!

https://github.com/wolfpld/tracy/releases/tag/v0.7.3

GUIDE

https://github.com/project-topaz/topaz/wiki/Performance-Profiling-with-Tracy

I affirm:

zach2good commented 3 years ago

Note to self:

To report data, use the TracyPlot(name, value) macro.
To configure how plot values are presented by the profiler, you may use the TracyPlotConfig(name,
format) macro, where format is one of the following options:
• tracy::PlotFormatType::Number – values will be displayed as plain numbers.
• tracy::PlotFormatType::Memory – treats the values as memory sizes. Will display kilobytes,
megabytes, etc
//what:
//LUA_GCCOUNT: returns the current amount of memory (in Kbytes) in use by Lua.
//LUA_GCCOUNTB: returns the remainder of dividing the current amount of bytes of memory in use by Lua by 1024.
//LUA_API int (lua_gc) (lua_State *L, int what, int data);

#ifdef TRACY_ENABLE
TracyPlotConfig("Lua Memory Usage", tracy::PlotFormatType::Memory);
TracyPlot("Lua Memory Usage", lua_gc(L, LUA_GCCOUNT, 0) / 1024); // from kb to b
#endif