Beispiel #1
0
 public RoutineStats[] GetStats()
 {
     RoutineStats[] stats = new RoutineStats[m_Fibers.Count];
     for (int i = 0; i < stats.Length; ++i)
     {
         stats[i] = m_Fibers[i].GetStats();
     }
     return(stats);
 }
Beispiel #2
0
        public RoutineStats[] GetStats()
        {
            if (m_Fiber == null)
            {
                return(new RoutineStats[0]);
            }

            RoutineStats[] stats = new RoutineStats[1];
            stats[0] = m_Fiber.GetStats();
            return(stats);
        }
Beispiel #3
0
        public RoutineStats GetStats()
        {
            RoutineStats stats = new RoutineStats();

            stats.Handle = m_Handle;
            stats.Host   = ReferenceEquals(m_Host, Manager) ? null : m_Host;

            if (m_Disposing || (!m_HostedByManager && !m_Host))
            {
                stats.State = RoutineState.Disposing;
            }
            else if (IsPaused())
            {
                stats.State = RoutineState.Paused;
            }
            else if (m_WaitTime > 0)
            {
                stats.State = RoutineState.WaitTime;
            }
            else if (m_UnityWait != null)
            {
                stats.State = RoutineState.WaitUnity;
            }
            else
            {
                stats.State = RoutineState.Running;
            }

            stats.TimeScale = m_TimeScale;
            stats.Name      = Name;
            stats.Priority  = Priority;

            if (m_StackPosition >= 0)
            {
                IEnumerator current = m_Stack[m_StackPosition];
                stats.Function = CleanIteratorName(current);

                // HACK - to visualize combine iterators properly
                ParallelFibers combine = current as ParallelFibers;
                if (combine != null)
                {
                    stats.Nested = combine.GetStats();
                }
            }
            else
            {
                stats.Function = null;
            }

            stats.StackDepth = m_StackPosition + 1;

            return(stats);
        }
Beispiel #4
0
        /// <summary>
        /// Returns an array of stats on all currently
        /// running Routines.
        /// </summary>
        public RoutineStats[] GetRoutineStats()
        {
            if (Fibers.TotalActive == 0)
            {
                return(null);
            }

            RoutineStats[] stats = new RoutineStats[Fibers.TotalActive];

            int   next  = 0;
            Fiber fiber = Fibers.StartActive(ref next);
            int   i     = 0;

            while (fiber != null)
            {
                stats[i++] = fiber.GetStats();
                fiber      = Fibers.TraverseActive(ref next);
            }

            return(stats);
        }
Beispiel #5
0
        public RoutineStats GetStats()
        {
            RoutineStats stats = new RoutineStats();

            stats.Handle = m_Handle;
            stats.Host   = ReferenceEquals(m_Host, Manager) ? null : m_Host;

            if (m_Disposing || (!m_HostedByManager && !m_Host))
            {
                stats.State = RoutineState.Disposing;
            }
            else if (m_LockCount > 0)
            {
                stats.State = RoutineState.Locked + ": " + m_LockCount;
            }
            else if (m_WaitTime > 0)
            {
                stats.State = RoutineState.WaitTime + ": " + m_WaitTime.ToString("0.000");
            }
            else if (IsPaused())
            {
                stats.State = RoutineState.Paused;
            }
            else if (m_UnityWait != null)
            {
                stats.State = RoutineState.WaitUnity;
            }
            else if (m_YieldPhase == YieldPhase.WaitForEndOfFrame)
            {
                stats.State = RoutineState.WaitEndOfFrame;
            }
            else if (m_YieldPhase == YieldPhase.WaitForFixedUpdate)
            {
                stats.State = RoutineState.WaitFixedUpdate;
            }
            else if (m_YieldPhase == YieldPhase.WaitForLateUpdate)
            {
                stats.State = RoutineState.WaitLateUpdate;
            }
            else if (m_YieldPhase == YieldPhase.WaitForUpdate)
            {
                stats.State = RoutineState.WaitUpdate;
            }
            else if (m_YieldPhase == YieldPhase.WaitForCustomUpdate)
            {
                stats.State = RoutineState.WaitCustomUpdate;
            }
            else if (m_YieldPhase == YieldPhase.WaitForThinkUpdate)
            {
                stats.State = RoutineState.WaitThinkUpdate;
            }
            else if (m_YieldPhase == YieldPhase.WaitForRealtimeUpdate)
            {
                stats.State = RoutineState.WaitRealtimeUpdate;
            }
            else
            {
                stats.State = RoutineState.Running;
            }

            stats.TimeScale = m_TimeScale;
            stats.Name      = Name;
            stats.Priority  = Priority;
            stats.Phase     = m_UpdatePhase;

            if (m_StackPosition >= 0)
            {
                IEnumerator current = m_Stack[m_StackPosition];
                stats.Function = CleanIteratorName(current);

                INestedFiberContainer nested = current as INestedFiberContainer;
                if (nested != null)
                {
                    stats.Nested = nested.GetStats();
                }
            }
            else
            {
                stats.Function = null;
            }

            stats.StackDepth = m_StackPosition + 1;

            return(stats);
        }