public LayoutInstanceMetric(LayoutInstanceMetric parent, int level, IElement component)
 {
     Level     = level;
     Parent    = parent;
     Component = component;
     Start     = DateTimeOffset.Now;
     _sw       = Stopwatch.StartNew();
 }
        public static string Format(LayoutInstanceMetric metrics)
        {
            var sb = new StringBuilder();

            var preAppend = metrics.Children.Count > 0 ? "+" : string.Empty;

            sb.AppendLine($"{new string(' ',metrics.Level*LevelSpaceMultiplier)} {preAppend} {metrics.Start:HH:mm:ss.FFF} {metrics.Component.GetType().FriendlyName()} {metrics.ElapsedMilliseconds}ms");

            if (metrics.Children.Count > 0)
            {
                foreach (var child in metrics.Children)
                {
                    sb.Append((string)Format(child));
                }
            }

            return(sb.ToString());
        }
 public void Add(LayoutInstanceMetric layoutInstanceMetric)
 {
     Children.Add(layoutInstanceMetric);
 }