Esempio n. 1
0
 private string GetTimePercent(RecorderItem recorderItem)
 {
     if (recorderItem.TreeNodeDeepLevel == 1)
     {
         var totalTicks = GetTotalTicks();
         if (totalTicks == 0D)
         {
             return("0.00%");
         }
         else
         {
             return((recorderItem.TotalTicks / totalTicks).ToString("##.##%"));
         }
     }
     else if (recorderItem.TreeNodeDeepLevel >= 2)
     {
         if (recorderItem.ParentRecorderItem.TotalTicks == 0)
         {
             return("0.00%");
         }
         else
         {
             return((recorderItem.TotalTicks / recorderItem.ParentRecorderItem.TotalTicks).ToString("##.##%"));
         }
     }
     return("0.00%");
 }
Esempio n. 2
0
        private List <RecorderItem> GetChildRecorderItems(RecorderItem parentRecorderItem)
        {
            if (parentRecorderItem == null)
            {
                return(new List <RecorderItem>());
            }
            List <RecorderItem> childRecorderItems = new List <RecorderItem>();

            foreach (RecorderItem recorderItem in _recorderItemList)
            {
                if (recorderItem.Id == parentRecorderItem.Id)
                {
                    continue;
                }
                if (recorderItem.StartTicks > parentRecorderItem.StartTicks && recorderItem.EndTicks < parentRecorderItem.EndTicks)
                {
                    RecorderItem directParent = GetDirectParent(recorderItem);
                    if (directParent != null && directParent.Id == parentRecorderItem.Id)
                    {
                        childRecorderItems.Add(recorderItem);
                    }
                }
            }
            return(childRecorderItems);
        }
Esempio n. 3
0
 internal void AddCompletedRecorderItem(RecorderItem recorderItem)
 {
     if (recorderItem != null && recorderItem.IsCompleted)
     {
         _recorderItemList.Add(recorderItem);
     }
 }
Esempio n. 4
0
        private void BuildChildRecorderItemTree(RecorderItem parentRecorderItem)
        {
            List <RecorderItem> childRecorderItems = GetChildRecorderItems(parentRecorderItem);

            foreach (RecorderItem childRecorderItem in childRecorderItems)
            {
                childRecorderItem.TreeNodeDeepLevel  = parentRecorderItem.TreeNodeDeepLevel + 1;
                childRecorderItem.ParentRecorderItem = parentRecorderItem;
                parentRecorderItem.ChildRecorderItems.Add(childRecorderItem);
                BuildChildRecorderItemTree(childRecorderItem);
            }
        }
Esempio n. 5
0
        private void GenerateRecorderItemTimeStrings(RecorderItem recorderItem, string leftSpace, string unitIndentString, List <string> recorderItemTimeStrings)
        {
            string recorderItemTimeStringFormat    = "{0}{1}({2})  {3}  {4}  {5}";
            string recorderItemTimeLeftSpaceString = leftSpace;

            for (int i = 0; i <= recorderItem.TreeNodeDeepLevel - 1; i++)
            {
                recorderItemTimeLeftSpaceString += unitIndentString;
            }

            recorderItemTimeStrings.Add(string.Format(recorderItemTimeStringFormat, new object[] { recorderItemTimeLeftSpaceString, (recorderItem.TotalTicks / 10000).ToString() + "ms", GetTimePercent(recorderItem), recorderItem.Description, recorderItem.StartTime.ToString() + ":" + recorderItem.StartTime.Millisecond.ToString(), recorderItem.EndTime.ToString() + ":" + recorderItem.EndTime.Millisecond.ToString() }));

            foreach (RecorderItem childRecorderItem in recorderItem.ChildRecorderItems)
            {
                GenerateRecorderItemTimeStrings(childRecorderItem, leftSpace, unitIndentString, recorderItemTimeStrings);
            }
        }
Esempio n. 6
0
 private RecorderItem GetDirectParent(RecorderItem recorderItem)
 {
     if (recorderItem == null)
     {
         return(null);
     }
     foreach (RecorderItem a in _recorderItemList)
     {
         if (recorderItem.Id == a.Id)
         {
             continue;
         }
         if (a.StartTicks < recorderItem.StartTicks && a.EndTicks > recorderItem.EndTicks)
         {
             return(a);
         }
     }
     return(null);
 }
Esempio n. 7
0
 private bool IsTopLevelRecorderItem(RecorderItem recorderItem)
 {
     if (recorderItem == null)
     {
         return(false);
     }
     foreach (RecorderItem a in _recorderItemList)
     {
         if (a.Id == recorderItem.Id)
         {
             continue;
         }
         if (a.StartTicks < recorderItem.StartTicks && a.EndTicks > recorderItem.EndTicks)
         {
             return(false);
         }
     }
     return(true);
 }
 private string GetTimePercent(RecorderItem recorderItem)
 {
     if (recorderItem.TreeNodeDeepLevel == 1)
     {
         var totalTicks = GetTotalTicks();
         if (totalTicks == 0D)
         {
             return "0.00%";
         }
         else
         {
             return (recorderItem.TotalTicks / totalTicks).ToString("##.##%");
         }
     }
     else if (recorderItem.TreeNodeDeepLevel >= 2)
     {
         if (recorderItem.ParentRecorderItem.TotalTicks == 0)
         {
             return "0.00%";
         }
         else
         {
             return (recorderItem.TotalTicks / recorderItem.ParentRecorderItem.TotalTicks).ToString("##.##%");
         }
     }
     return "0.00%";
 }
 private bool IsTopLevelRecorderItem(RecorderItem recorderItem)
 {
     if (recorderItem == null)
     {
         return false;
     }
     foreach (RecorderItem a in _recorderItemList)
     {
         if (a.Id == recorderItem.Id)
         {
             continue;
         }
         if (a.StartTicks < recorderItem.StartTicks && a.EndTicks > recorderItem.EndTicks)
         {
             return false;
         }
     }
     return true;
 }
 private RecorderItem GetDirectParent(RecorderItem recorderItem)
 {
     if (recorderItem == null)
     {
         return null;
     }
     foreach (RecorderItem a in _recorderItemList)
     {
         if (recorderItem.Id == a.Id)
         {
             continue;
         }
         if (a.StartTicks < recorderItem.StartTicks && a.EndTicks > recorderItem.EndTicks)
         {
             return a;
         }
     }
     return null;
 }
 private List<RecorderItem> GetChildRecorderItems(RecorderItem parentRecorderItem)
 {
     if (parentRecorderItem == null)
     {
         return new List<RecorderItem>();
     }
     List<RecorderItem> childRecorderItems = new List<RecorderItem>();
     foreach (RecorderItem recorderItem in _recorderItemList)
     {
         if (recorderItem.Id == parentRecorderItem.Id)
         {
             continue;
         }
         if (recorderItem.StartTicks > parentRecorderItem.StartTicks && recorderItem.EndTicks < parentRecorderItem.EndTicks)
         {
             RecorderItem directParent = GetDirectParent(recorderItem);
             if (directParent != null && directParent.Id == parentRecorderItem.Id)
             {
                 childRecorderItems.Add(recorderItem);
             }
         }
     }
     return childRecorderItems;
 }
        private void GenerateRecorderItemTimeStrings(RecorderItem recorderItem, string leftSpace, string unitIndentString, List<string> recorderItemTimeStrings)
        {
            string recorderItemTimeStringFormat = "{0}{1}({2})  {3}  {4}  {5}";
            string recorderItemTimeLeftSpaceString = leftSpace;
            for (int i = 0; i <= recorderItem.TreeNodeDeepLevel - 1; i++)
            {
                recorderItemTimeLeftSpaceString += unitIndentString;
            }

            recorderItemTimeStrings.Add(string.Format(recorderItemTimeStringFormat, new object[] { recorderItemTimeLeftSpaceString, (recorderItem.TotalTicks / 10000).ToString() + "ms", GetTimePercent(recorderItem), recorderItem.Description, recorderItem.StartTime.ToString() + ":" + recorderItem.StartTime.Millisecond.ToString(), recorderItem.EndTime.ToString() + ":" + recorderItem.EndTime.Millisecond.ToString() }));

            foreach (RecorderItem childRecorderItem in recorderItem.ChildRecorderItems)
            {
                GenerateRecorderItemTimeStrings(childRecorderItem, leftSpace, unitIndentString, recorderItemTimeStrings);
            }
        }
 private void BuildChildRecorderItemTree(RecorderItem parentRecorderItem)
 {
     List<RecorderItem> childRecorderItems = GetChildRecorderItems(parentRecorderItem);
     foreach (RecorderItem 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);
     }
 }