Exemplo n.º 1
0
 public CoTrackerDatabase()
 {
     CoGraphUtil.InitParams(CoGraphUtil.GName_Creation, 80, new Color(0.4f, 0.7f, 0.9f, 0.9f));
     CoGraphUtil.InitParams(CoGraphUtil.GName_Termination, 80, new Color(0.4f, 0.7f, 0.9f, 0.9f));
     CoGraphUtil.InitParams(CoGraphUtil.GName_ExecCount, 100, new Color(0.8f, 0.6f, 0.1f, 0.8f));
     CoGraphUtil.InitParams(CoGraphUtil.GName_ExecTime, 250, new Color(0.8f, 0.2f, 0.5f, 0.8f));
 }
Exemplo n.º 2
0
 void GraphPanel_SelectionChanged(int selectionIndex)
 {
     if (_table != null)
     {
         _selectedSnapshotTime = CoGraphUtil.GetSnapshotTime(selectionIndex);
         List <object> entries = _database.PopulateEntries(_selectedSnapshotTime);
         _table.RefreshData(entries);
     }
 }
Exemplo n.º 3
0
    public void CreateSnapshot(float snapshotTime)
    {
        int   creationCount    = 0;
        int   executionCount   = 0;
        int   terminationCount = 0;
        float executionTime    = 0.0f;

        HashSet <int> curSnapshot = new HashSet <int>();

        _snapshots.Add(new KeyValuePair <float, HashSet <int> >(snapshotTime, curSnapshot));

        while (_activityQueue.Count > 0)
        {
            CoroutineActivity activity = _activityQueue.Peek();
            if (activity.timestamp < _lastSnapshotTime)
            {
                Debug.LogErrorFormat("[CoEd] error: {0} is earlier than last snapshot, discarded. (activity_time: {1:0.000}, last_snapshot: {2:0.000})",
                                     activity.GetType().ToString(), activity.timestamp, _lastSnapshotTime);

                activity = _activityQueue.Dequeue();
                continue;
            }
            else if (activity.timestamp >= snapshotTime)
            {
                // stop current activity
                break;
            }

            activity = _activityQueue.Dequeue();

            curSnapshot.Add(activity.seqID);

            CoroutineInfo info;
            if (!_coroutines.TryGetValue(activity.seqID, out info))
            {
                if (!(activity is CoroutineCreation))
                {
                    Debug.LogErrorFormat("activity ({0}:{1}) not found (possibly CoroutineCreation missing), ignored.", activity.seqID, activity.ToString());
                    continue;
                }

                info = new CoroutineInfo();
                _coroutines[activity.seqID] = info;
            }

            if (activity is CoroutineCreation)
            {
                creationCount++;
                info.creation = activity as CoroutineCreation;
            }
            else if (activity is CoroutineExecution)
            {
                var exec = activity as CoroutineExecution;

                executionCount++;
                executionTime += exec.timeConsumed;

                info.executions.Add(new KeyValuePair <float, float>(exec.timestamp, exec.timeConsumed));
            }
            else if (activity is CoroutineTermination)
            {
                terminationCount++;
                info.termination = activity as CoroutineTermination;
            }
        }

        // 这个函数一定要在 CoGraphUtil.LogData() 也就是 step 之前调用(否则 mCurrentIndex 就变到下一帧去了)
        CoGraphUtil.RecordSnapshot(snapshotTime);

        CoGraphUtil.LogData(CoGraphUtil.GName_Creation, creationCount);
        CoGraphUtil.LogData(CoGraphUtil.GName_Termination, terminationCount);
        CoGraphUtil.LogData(CoGraphUtil.GName_ExecCount, executionCount);
        CoGraphUtil.LogData(CoGraphUtil.GName_ExecTime, executionTime);
    }