Esempio n. 1
0
 /// <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;
 }
Esempio n. 2
0
 internal static void EndTick()
 {
     if (!isRunning)
     {
         return;
     }
     if (CurrentTick == null)
     {
         return;
     }
     CurrentTick = null;
 }
Esempio n. 3
0
        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);
        }
Esempio n. 4
0
        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;
        }
Esempio n. 5
0
 public static void Stop()
 {
     Ticks       = null; //leave to GC
     CurrentTick = null; //leave to GC
     isRunning   = false;
 }