void TablePanel_CoroutineSelected(object selected, int col) { CoTableEntry entry = selected as CoTableEntry; if (entry == null) { return; } CoroutineInfo info = _database.GetCoroutineInfo(entry.SeqID); if (info == null) { return; } string termTime = info.termination != null?info.termination.timestamp.ToString("0.000") : "(not yet)"; _coroutineName = string.Format("{0}", info.creation.mangledName); _coroutineInfo = string.Format("SeqID: {0}, Created: {1:0.00}, Terminated: {2}", info.creation.seqID, info.creation.timestamp, termTime); _coroutineStacktrace = "Stacktrace:\n\n" + info.creation.stacktrace; StringBuilder sb = new StringBuilder(1024); sb.AppendFormat("Executions: ({0})\n\n", info.executions.Count); for (int i = 0; i < info.executions.Count; i++) { string sel = ""; var item = info.executions[i]; if (item.Key <= _selectedSnapshotTime && item.Key > _selectedSnapshotTime - CoTrackerDatabase.SnapshotInterval) { sel = "(in selected snapshot)"; } sb.AppendFormat(" ({0}) timestamp: {1:0.000} duration: {2:0.000} {3}\n", i, item.Key, item.Value, sel); if (sb.Length > 10000) { sb.Append("(cutting the rest off since it's too long...)"); break; } } _coroutineExecutions = sb.ToString(); }
public List <object> PopulateEntries(float snapshotTime) { HashSet <int> coIDs = FindSnapshotCoroutines(snapshotTime); if (coIDs == null || coIDs.Count == 0) { return(null); } List <object> ret = new List <object>(); foreach (var id in coIDs) { CoroutineInfo info; if (_coroutines.TryGetValue(id, out info)) { CoTableEntry entry = new CoTableEntry(); entry.SeqID = info.creation.seqID; entry.Name = info.creation.mangledName; if (info.executions.Count > 0) { ExtractCoroutineSelectedInfo(snapshotTime, info, out entry.ExecSelectedCount, out entry.ExecSelectedTime, out entry.ExecAccumCount, out entry.ExecAccumTime); } ret.Add(entry); } else { Debug.LogErrorFormat("coroutine {0} not found in database.", id); } } return(ret); }