コード例 #1
0
 public ProfiledSegment(ProfiledSegment parent, string name)
 {
     this.parent = parent;
     this.name   = name;
     stopwatch   = new Stopwatch();
     children    = new ProfiledSegmentCollection();
 }
コード例 #2
0
        public static void EndSample()
        {
            currentSegment.stopwatch.Stop();

            if (currentSegment.parent != null)
            {
                currentSegment = currentSegment.parent;
            }

            if (UnityThread.allowsAPI)
            {
                Profiler.EndSample();
            }

            Monitor.Exit(@lock);
        }
コード例 #3
0
        public static void BeginSample(string name)
        {
            Monitor.Enter(@lock);

            if (!currentSegment.children.Contains(name))
            {
                currentSegment.children.Add(new ProfiledSegment(currentSegment, name));
            }

            currentSegment = currentSegment.children[name];
            currentSegment.calls++;
            currentSegment.stopwatch.Start();

            if (UnityThread.allowsAPI)
            {
                Profiler.BeginSample(name);
            }
        }
コード例 #4
0
 static ProfilingUtility()
 {
     currentSegment = rootSegment = new ProfiledSegment(null, "Root");
 }
コード例 #5
0
 public static void Clear()
 {
     currentSegment = rootSegment = new ProfiledSegment(null, "Root");
 }