Skip to content

Debugging ‐ Profiler API

Wagner GFX edited this page Dec 4, 2024 · 3 revisions

This module's main use is to help debug code execution through the Profiler window. But the code is a useful template to create other profiler modules beyond just performance tracking.

CorePackage.Debugging.ProfilerAPI.ScriptWatcher

It works by wrapping your code with the functions Begin() and End(), or with a using statement.

ScriptWatcher.Begin();
//Your Code
ScriptWatcher.End();

//OR

using (ScriptWatcher.Auto())
{
    //Your Code
}

Each time the wrapped code is executed, it will show:

  1. As a green graph line in the Profiler module named Watches.
  2. As a process named WatchedScript in the CPU Usage's timeline and hierarchy views.

This allows to easily pinpoint the exact frame the function is being called and identify execution data such as GCAlloc, execution time, performance spikes, etc.

Tip: To find the process in the Profiler's Hierarchy View, use the search box. The selected process will be highlighted when switching to the Timeline view.

Clone this wiki locally