/// <summary> /// Starts recording data for the Profiler /// </summary> /// <param name="historyLength">The amount of ticks to keep in memory</param> public static void Start(int historyLength) { if (isRunning) { return; } EventIdCounter = 0; Ticks = new FixedQueue <ProfilerTick>(historyLength); tickHistory = historyLength; CurrentTick = null; isRunning = true; }
internal static void EndTick() { if (!isRunning) { return; } if (CurrentTick == null) { return; } CurrentTick = null; }
public static int Stop(ref List <ProfilerTick> tickBuffer) { if (!isRunning) { return(0); } int iteration = Ticks.Count > tickBuffer.Count ? tickBuffer.Count : Ticks.Count; for (int i = 0; i < iteration; i++) { tickBuffer[i] = Ticks[i]; } Ticks = null; //leave to GC CurrentTick = null; //leave to GC isRunning = false; return(iteration); }
internal static void StartTick(TickType type) { if (!isRunning) { return; } if (Ticks.Count == tickHistory) { Ticks.Dequeue(); } ProfilerTick tick = new ProfilerTick() { Type = type, Frame = Time.frameCount, EventId = EventIdCounter }; EventIdCounter++; Ticks.Enqueue(tick); CurrentTick = tick; }
public static void Stop() { Ticks = null; //leave to GC CurrentTick = null; //leave to GC isRunning = false; }