mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
Add support for Tracy profiler (#15113)
This commit is contained in:
parent
6f23de41fb
commit
4aec4fbe6f
19 changed files with 379 additions and 4 deletions
|
@ -1,6 +1,6 @@
|
|||
# Miscellaneous
|
||||
|
||||
## Profiling Minetest on Linux
|
||||
## Profiling Minetest on Linux with perf
|
||||
|
||||
We will be using a tool called "perf", which you can get by installing `perf` or `linux-perf` or `linux-tools-common`.
|
||||
|
||||
|
@ -36,3 +36,54 @@ Give both files to the developer and also provide:
|
|||
* commit the source was built from and/or modified source code (if applicable)
|
||||
|
||||
Hotspot will resolve symbols correctly when pointing the sysroot option at the collected libs.
|
||||
|
||||
|
||||
## Profiling with Tracy
|
||||
|
||||
[Tracy](https://github.com/wolfpld/tracy) is
|
||||
> A real time, nanosecond resolution, remote telemetry, hybrid frame and sampling
|
||||
> profiler for games and other applications.
|
||||
|
||||
It allows one to annotate important functions and generate traces, where one can
|
||||
see when each individual function call happened, and how long it took.
|
||||
|
||||
Tracy can also record when frames, e.g. server step, start and end, and inspect
|
||||
frames that took longer than usual. Minetest already contains annotations for
|
||||
its frames.
|
||||
|
||||
See also [Tracy's official documentation](https://github.com/wolfpld/tracy/releases/latest/download/tracy.pdf).
|
||||
|
||||
### Installing
|
||||
|
||||
Tracy consists of a client (Minetest) and a server (the gui).
|
||||
|
||||
Install the server, e.g. using your package manager.
|
||||
|
||||
### Building
|
||||
|
||||
Build Minetest with `-DDBUILD_WITH_TRACY=1`, this will fetch Tracy for building
|
||||
the Tracy client. And use `FETCH_TRACY_GIT_TAG` to get a version matching your
|
||||
Tracy server, e.g. `-DFETCH_TRACY_GIT_TAG=v0.11.0` if it's `0.11.0`.
|
||||
|
||||
To actually use Tracy, you also have to enable it with Tracy's build options:
|
||||
```
|
||||
-DTRACY_ENABLE=1 -DTRACY_ONLY_LOCALHOST=1
|
||||
```
|
||||
|
||||
See Tracy's documentation for more build options.
|
||||
|
||||
### Using in C++
|
||||
|
||||
Start the Tracy server and Minetest. You should see Minetest in the menu.
|
||||
|
||||
To actually get useful traces, you have to annotate functions with `ZoneScoped`
|
||||
macros and recompile. Please refer to Tracy's official documentation.
|
||||
|
||||
### Using in Lua
|
||||
|
||||
Tracy also supports Lua.
|
||||
If built with Tracy, Minetest loads its API in the global `tracy` table.
|
||||
See Tracy's official documentation for more information.
|
||||
|
||||
Note: The whole Tracy Lua API is accessible to all mods. And we don't check if it
|
||||
is or becomes insecure. Run untrusted mods at your own risk.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue