LayerProcGen v0.1.0
Layer-based infinite procedural generation
|
Tool for measuring where time is spent in long-running processes. More...
Classes | |
struct | ProfilerHandle |
class | ProfilerInfo |
Static Public Member Functions | |
static bool | AnyCurrent () |
static ProfilerHandle | Begin (ProfilerHandle parentHandle, string sectionName, int priority=0) |
static ProfilerHandle | Begin (string sectionName, int priority=0) |
static void | BeginThread (string threadGroupName, string threadName) |
static void | End (ProfilerHandle handle) |
static void | EndThread () |
static string | GetStatus () |
static void | Log () |
Static Public Attributes | |
static bool | isActive = true |
Events | |
static Action< string > | ForwardBeginSample |
static Action< string, string > | ForwardBeginThread |
static Action | ForwardEndSample |
static Action | ForwardEndThread |
Tool for measuring where time is spent in long-running processes.
Measure code by wrapping it in o:SimpleProfiler.Begin and SimpleProfiler.End. Times for entries with the same sectionName will be added together. Usage across different threads is supported.
SimpleProfiler.GetStatus can return a string at any time which shows a hierarchy of monitored calls, and a number of dots to the right of each call which corresponds to how many threads are currently inside that call. For sufficiently slow bottlenecks, this makes it possible to spot them by eye, and just gives an intuitive feel for the flow of the threaded code execution.
In generation of chunks, the chunk stores a ProfilerHandle which can be used as the parentHandle parameter of the o:SimpleProfiler.Begin method. In turn, the SimpleProfiler.End call must be supplied the handle returned by SimpleProfiler.Begin, in order for the profiler to be able to connect matching Begin and End calls happening simultaneously across many threads.
If you nest Begin/End calls within each other, the inner Begin call should be given the ProfilerHandle returned by the outer Begin call as parentHandle parameter.
The LayerManager will call SimpleProfiler.Log whenever generation has completed, which logs the times to the system Console (not Unity's console).