Skip to main content

ProfilingCommandModule

A static class in Root.Township, Alta.Console.Commands.

Console module profiling: Unity profiler samples, heap dumps and memory snapshots. Play mode only, needs server_owner.

Fields​

3 private and internal fields
MemberWhat it is
private static TaskCompletionSource<bool> finishUnloadingTask CleanMemDump awaits until the last tracked chunk unloads.
private static HashSet<Chunk> loadedChunksChunks CleanMemDump is waiting on to fully unload.
private static Logger loggerNLog logger for this module.

Methods​

MemberWhat it is
static async Task<bool> Sample(string name, string path = "", int frames = 150, Action postAction = null)profiling sample: records a binary Unity profiler log for a number of frames to a .raw file and completes when done.
7 private and internal methods
MemberWhat it is
private static void Callback(string arg1, bool arg2)Unused debug callback that logs its two arguments.
private static void ChunkUnloaded(Chunk unloadedChunk)Handler for a chunk's FullyUnloaded during CleanMemDump; completes the wait once every tracked chunk has unloaded.
private static async void CleanMemDump(string name = "CleanSlateMemoryDump", string path = "")profiling cleanslatememory: warns players, waits 90 seconds, kicks everyone, waits for all chunks to unload, then takes a full memory snapshot.
private static void DumpSize()profiling dumpsize: writes object size info to a file through UnityHeapEx.HeapDump.
private static void HeapDump()profiling heapdump: writes a heap dump through UnityHeapEx.HeapDump.
private static void MemDump(string name = "memorydump", string path = null)profiling memorydump: takes a Unity memory profiler snapshot into the memory_dump storage folder (or a given path).
private static IEnumerator Profile(bool wasProfilingByName, int frames, Action postAction) (iterator)Coroutine behind Sample: waits the given number of frames, stops the profiler, logs FPS and runs the post action.