internal void AddCompletedRecorderItem(RecorderItem recorderItem) { if (recorderItem != null && recorderItem.IsCompleted) { _recorderItemList.Add(recorderItem); } }
private void BuildChildRecorderItemTree(RecorderItem parentRecorderItem) { var childRecorderItems = GetChildRecorderItems(parentRecorderItem); foreach (var childRecorderItem in childRecorderItems) { childRecorderItem.TreeNodeDeepLevel = parentRecorderItem.TreeNodeDeepLevel + 1; childRecorderItem.ParentRecorderItem = parentRecorderItem; parentRecorderItem.ChildRecorderItems.Add(childRecorderItem); BuildChildRecorderItemTree(childRecorderItem); } }
private string GetTimePercent(RecorderItem recorderItem) { if (recorderItem.TreeNodeDeepLevel == 1) { var totalTicks = GetTotalTicks(); return((int)totalTicks == 0 ? "0.00%" : (recorderItem.TotalTicks / totalTicks).ToString("##.##%")); } if (recorderItem.TreeNodeDeepLevel >= 2) { return((int)recorderItem.ParentRecorderItem.TotalTicks == 0 ? "0.00%" : (recorderItem.TotalTicks / recorderItem.ParentRecorderItem.TotalTicks).ToString("##.##%")); } return("0.00%"); }
private void GenerateRecorderItemTimeStrings(RecorderItem recorderItem, string leftSpace, string unitIndentString, List <string> recorderItemTimeStrings) { const string recorderItemTimeStringFormat = "{0}{1}({2}) {3} {4} {5}"; var recorderItemTimeLeftSpaceString = leftSpace; for (var i = 0; i <= recorderItem.TreeNodeDeepLevel - 1; i++) { recorderItemTimeLeftSpaceString += unitIndentString; } recorderItemTimeStrings.Add(string.Format(recorderItemTimeStringFormat, new object[] { recorderItemTimeLeftSpaceString, (recorderItem.TotalTicks / 10000) + "ms", GetTimePercent(recorderItem), recorderItem.Description, recorderItem.StartTime + ":" + recorderItem.StartTime.Millisecond, recorderItem.EndTime + ":" + recorderItem.EndTime.Millisecond })); foreach (var childRecorderItem in recorderItem.ChildRecorderItems) { GenerateRecorderItemTimeStrings(childRecorderItem, leftSpace, unitIndentString, recorderItemTimeStrings); } }
private bool IsTopLevelRecorderItem(RecorderItem recorderItem) { return recorderItem != null && _recorderItemList.Where(a => a.Id != recorderItem.Id).All(a => !(a.StartTicks < recorderItem.StartTicks) || !(a.EndTicks > recorderItem.EndTicks)); }
private string GetTimePercent(RecorderItem recorderItem) { if (recorderItem.TreeNodeDeepLevel == 1) { var totalTicks = GetTotalTicks(); return (int)totalTicks == 0 ? "0.00%" : (recorderItem.TotalTicks / totalTicks).ToString("##.##%"); } if (recorderItem.TreeNodeDeepLevel >= 2) { return (int)recorderItem.ParentRecorderItem.TotalTicks == 0 ? "0.00%" : (recorderItem.TotalTicks / recorderItem.ParentRecorderItem.TotalTicks).ToString("##.##%"); } return "0.00%"; }
private RecorderItem GetDirectParent(RecorderItem recorderItem) { return recorderItem == null ? null : _recorderItemList.Where(a => recorderItem.Id != a.Id).FirstOrDefault(a => a.StartTicks < recorderItem.StartTicks && a.EndTicks > recorderItem.EndTicks); }
private IEnumerable<RecorderItem> GetChildRecorderItems(RecorderItem parentRecorderItem) { return parentRecorderItem == null ? new List<RecorderItem>() : (from recorderItem in _recorderItemList where recorderItem.Id != parentRecorderItem.Id where recorderItem.StartTicks > parentRecorderItem.StartTicks && recorderItem.EndTicks < parentRecorderItem.EndTicks let directParent = GetDirectParent(recorderItem) where directParent != null && directParent.Id == parentRecorderItem.Id select recorderItem).ToList(); }
private void GenerateRecorderItemTimeStrings(RecorderItem recorderItem, string leftSpace, string unitIndentString, List<string> recorderItemTimeStrings) { const string recorderItemTimeStringFormat = "{0}{1}({2}) {3} {4} {5}"; var recorderItemTimeLeftSpaceString = leftSpace; for (var i = 0; i <= recorderItem.TreeNodeDeepLevel - 1; i++) { recorderItemTimeLeftSpaceString += unitIndentString; } recorderItemTimeStrings.Add(string.Format(recorderItemTimeStringFormat, new object[] { recorderItemTimeLeftSpaceString, (recorderItem.TotalTicks / 10000) + "ms", GetTimePercent(recorderItem), recorderItem.Description, recorderItem.StartTime + ":" + recorderItem.StartTime.Millisecond, recorderItem.EndTime + ":" + recorderItem.EndTime.Millisecond })); foreach (var childRecorderItem in recorderItem.ChildRecorderItems) { GenerateRecorderItemTimeStrings(childRecorderItem, leftSpace, unitIndentString, recorderItemTimeStrings); } }
private void BuildChildRecorderItemTree(RecorderItem parentRecorderItem) { var childRecorderItems = GetChildRecorderItems(parentRecorderItem); foreach (var childRecorderItem in childRecorderItems) { childRecorderItem.TreeNodeDeepLevel = parentRecorderItem.TreeNodeDeepLevel + 1; childRecorderItem.ParentRecorderItem = parentRecorderItem; parentRecorderItem.ChildRecorderItems.Add(childRecorderItem); BuildChildRecorderItemTree(childRecorderItem); } }
internal void AddCompletedRecorderItem(RecorderItem recorderItem) { if (recorderItem != null && recorderItem.IsCompleted) { _recorderItemList.Add(recorderItem); } }
private IEnumerable <RecorderItem> GetChildRecorderItems(RecorderItem parentRecorderItem) { return(parentRecorderItem == null ? new List <RecorderItem>() : (from recorderItem in _recorderItemList where recorderItem.Id != parentRecorderItem.Id where recorderItem.StartTicks > parentRecorderItem.StartTicks && recorderItem.EndTicks < parentRecorderItem.EndTicks let directParent = GetDirectParent(recorderItem) where directParent != null && directParent.Id == parentRecorderItem.Id select recorderItem).ToList()); }
private RecorderItem GetDirectParent(RecorderItem recorderItem) { return(recorderItem == null ? null : _recorderItemList.Where(a => recorderItem.Id != a.Id).FirstOrDefault(a => a.StartTicks < recorderItem.StartTicks && a.EndTicks > recorderItem.EndTicks)); }
private bool IsTopLevelRecorderItem(RecorderItem recorderItem) { return(recorderItem != null && _recorderItemList.Where(a => a.Id != recorderItem.Id).All(a => !(a.StartTicks < recorderItem.StartTicks) || !(a.EndTicks > recorderItem.EndTicks))); }