public void AddChildResult(ThreadLocalDeepProfiler.Watcher w)
 {
     if (this.children == null)
     {
         this.children = new List <ThreadLocalDeepProfiler.Watcher>();
     }
     this.children.Add(w);
 }
        private void Output(ThreadLocalDeepProfiler.Watcher root)
        {
            StringBuilder stringBuilder = new StringBuilder();

            if (UnityData.IsInMainThread)
            {
                stringBuilder.AppendLine("--- Main thread ---");
            }
            else
            {
                stringBuilder.AppendLine("--- Thread " + Thread.CurrentThread.ManagedThreadId + " ---");
            }
            this.AppendStringRecursive(stringBuilder, root, 0);
            Log.Message(stringBuilder.ToString());
        }
 private void AppendStringRecursive(StringBuilder sb, ThreadLocalDeepProfiler.Watcher w, int depth)
 {
     sb.AppendLine(string.Concat(new object[]
     {
         ThreadLocalDeepProfiler.Prefixes[depth],
         " ",
         w.Watch.ElapsedMilliseconds,
         "ms ",
         w.Label
     }));
     if (w.Children != null)
     {
         for (int i = 0; i < w.Children.Count; i++)
         {
             this.AppendStringRecursive(sb, w.Children[i], depth + 1);
         }
     }
 }
 public void End()
 {
     if (!Prefs.LogVerbose)
     {
         return;
     }
     if (this.watchers.Count == 0)
     {
         Log.Error("Ended deep profiling while not profiling.");
         return;
     }
     ThreadLocalDeepProfiler.Watcher watcher = this.watchers.Pop();
     watcher.Watch.Stop();
     if (this.watchers.Count > 0)
     {
         this.watchers.Peek().AddChildResult(watcher);
     }
     else
     {
         this.Output(watcher);
     }
 }