This repository has been archived by the owner on Apr 22, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 13
Performance Profiling
Dylan Dumesnil edited this page Jun 30, 2020
·
1 revision
MDProfiler is a very simple profiler. It will track the time it takes for a block of code to run and if enabled, log it. It's intended to be used to compare timings that are also captured with MDProfiler, don't expect measurements to be accurate to real-world timings.
To use MDProfiler in code is simple:
#if DEBUG
using (MDProfiler Profiler = new MDProfiler("IDENTITYING_STRING_HERE"))
#endif
{
// Code you want to profile here
}
The debug check is recommended to not have it run in your release builds.
To enable the profile logging for profiles, add -logprofile
to your command line args when launching Godot/your game.
Currently, this will enable logging for all MDProfiler instances and can get very log spammy.
To enable profiling for just one category, you can either call the functions in code:
MDProfiler.EnableProfile("IDENTITYING_STRING_HERE");
MDProfiler.DisableProfile("IDENTITYING_STRING_HERE");
MDProfiler.ToggleProfile("IDENTITYING_STRING_HERE");
or as a command:
EnableProfile IDENTITYING_STRING_HERE
DisableProfile IDENTITYING_STRING_HERE
ToggleProfile IDENTITYING_STRING_HERE
[2018-09-17 00:15:40.932][PEER 0] [LogProfiler::Info] Profiling [IDENTITYING_STRING_HERE] took 20us