Revision Difference
Profiler#565751
<cat>Dev</cat>⤶
<title>Profiler</title>⤶
⤶
# What this is⤶
⤶
Profilers are tools for developers to find things taking memory or slowing down the server.⤶
⤶
# Enabling the profiler⤶
⤶
To enable this feature, start the server with `-enableProfiler` - it's the commandline argument. Some hostings might call it Startup Arguments. Once the server is started with it, snapshots can be created for developers to go through.⤶
⤶
<note>Keeping profiler enabled will slightly decrease performance until it is fully disabled by removing the commandline argument.</note>⤶
⤶
# Creating a snapshot⤶
⤶
There are two commands to create a snapshot, both of which will save it to a folder called `profiler`. Keep in mind that the server may experience significantly degraded performance while it's being recorded.⤶
⤶
The simplest one is `profile.perfsnapshot [delay] [name] [frames]` to start creating a snapshot called `[name]` in `[delay]` seconds for `[frames]` frames *(between 1-10)*. The upside is, it's fairly simple, quick, and displays a countdown in chat. But there is an important limit - it only records up to 10 frames, which won't provide any useful information if something only occurs once every few seconds or even minutes.⤶
⤶
The other option is `profile.perfsnapshot_stream [name] [buffer size(MB) of main thread] [buffer size(MB) per other thread]`. It has no countdown but still broadcasts into chat when it begins and ends. This command will keep receiving data until the buffer is filled, size of which is limited to 256 MB. This is significantly more useful as it can keep recording for many seconds or even minutes depending on your server.⤶
⤶
<warning>Wait for the snapshot to be fully stopped and saved before starting more or changing settings, otherwise your server can crash.</warning>⤶
⤶
# Viewing a snapshot⤶
⤶
You can view all snapshots in the `profiler` folder - they are saved as archives (`.json.gz`) to save space. You can open and visualize `.json` snapshots with tools like [Perfetto.dev](https://ui.perfetto.dev/). The rest is up to the developer. GLHF!
Garry's Mod
Rust
Steamworks
Wiki Help