private void CalculateBars(Rect r, int frameIndex, float time)
        {
            ProfilerFrameDataIterator profilerFrameDataIterator = new ProfilerFrameDataIterator();
            int   groupCount = profilerFrameDataIterator.GetGroupCount(frameIndex);
            float num        = 0f;

            profilerFrameDataIterator.SetRoot(frameIndex, 0);
            int threadCount = profilerFrameDataIterator.GetThreadCount(frameIndex);
            int i;

            for (i = 0; i < threadCount; i++)
            {
                profilerFrameDataIterator.SetRoot(frameIndex, i);
                string groupname = profilerFrameDataIterator.GetGroupName();
                ProfilerTimelineGUI.GroupInfo groupInfo = this.groups.Find((ProfilerTimelineGUI.GroupInfo g) => g.name == groupname);
                if (groupInfo == null)
                {
                    groupInfo          = new ProfilerTimelineGUI.GroupInfo();
                    groupInfo.name     = groupname;
                    groupInfo.height   = 20f;
                    groupInfo.expanded = false;
                    groupInfo.threads  = new List <ProfilerTimelineGUI.ThreadInfo>();
                    this.groups.Add(groupInfo);
                    if (groupname == string.Empty || groupname == "Unity Job System")
                    {
                        groupInfo.expanded = true;
                    }
                }
                List <ProfilerTimelineGUI.ThreadInfo> threads    = groupInfo.threads;
                ProfilerTimelineGUI.ThreadInfo        threadInfo = threads.Find((ProfilerTimelineGUI.ThreadInfo t) => t.threadIndex == i);
                if (threadInfo == null)
                {
                    threadInfo             = new ProfilerTimelineGUI.ThreadInfo();
                    threadInfo.name        = profilerFrameDataIterator.GetThreadName();
                    threadInfo.height      = 0f;
                    threadInfo.weight      = (threadInfo.desiredWeight = (float)((!groupInfo.expanded) ? 0 : 1));
                    threadInfo.threadIndex = i;
                    groupInfo.threads.Add(threadInfo);
                }
                if (threadInfo.weight != threadInfo.desiredWeight)
                {
                    threadInfo.weight = threadInfo.desiredWeight * time + (1f - threadInfo.desiredWeight) * (1f - time);
                }
                num += threadInfo.weight;
            }
            float num2 = 16f * (float)groupCount;
            float num3 = r.height - num2;
            float num4 = num3 / (num + 2f);

            foreach (ProfilerTimelineGUI.GroupInfo current in this.groups)
            {
                foreach (ProfilerTimelineGUI.ThreadInfo current2 in current.threads)
                {
                    current2.height = num4 * current2.weight;
                }
            }
            this.groups[0].expanded          = true;
            this.groups[0].height            = 0f;
            this.groups[0].threads[0].height = 3f * num4;
        }
Beispiel #2
0
        private void DrawBars(Rect r, int frameIndex)
        {
            float y = r.y;

            using (List <ProfilerTimelineGUI.GroupInfo> .Enumerator enumerator1 = this.groups.GetEnumerator())
            {
                while (enumerator1.MoveNext())
                {
                    ProfilerTimelineGUI.GroupInfo current1 = enumerator1.Current;
                    bool flag = current1.name == string.Empty;
                    if (!flag)
                    {
                        float height   = current1.height;
                        bool  expanded = current1.expanded;
                        current1.expanded = this.DrawBar(r, y, height, current1.name, true, expanded, false);
                        if (current1.expanded != expanded)
                        {
                            this.animationTime        = 0.0f;
                            this.lastScrollUpdate     = EditorApplication.timeSinceStartup;
                            EditorApplication.update += new EditorApplication.CallbackFunction(this.UpdateAnimatedFoldout);
                            using (List <ProfilerTimelineGUI.ThreadInfo> .Enumerator enumerator2 = current1.threads.GetEnumerator())
                            {
                                while (enumerator2.MoveNext())
                                {
                                    enumerator2.Current.desiredWeight = !current1.expanded ? 0.0f : 1f;
                                }
                            }
                        }
                        y += height;
                    }
                    using (List <ProfilerTimelineGUI.ThreadInfo> .Enumerator enumerator2 = current1.threads.GetEnumerator())
                    {
                        while (enumerator2.MoveNext())
                        {
                            ProfilerTimelineGUI.ThreadInfo current2 = enumerator2.Current;
                            float height = current2.height;
                            if ((double)height != 0.0)
                            {
                                this.DrawBar(r, y, height, current2.name, false, true, !flag);
                            }
                            y += height;
                        }
                    }
                }
            }
        }
 private void CalculateBars(Rect r, int frameIndex, float time)
 {
   ProfilerFrameDataIterator frameDataIterator = new ProfilerFrameDataIterator();
   int groupCount = frameDataIterator.GetGroupCount(frameIndex);
   float num1 = 0.0f;
   frameDataIterator.SetRoot(frameIndex, 0);
   int threadCount = frameDataIterator.GetThreadCount(frameIndex);
   // ISSUE: object of a compiler-generated type is created
   // ISSUE: variable of a compiler-generated type
   ProfilerTimelineGUI.\u003CCalculateBars\u003Ec__AnonStoreyAD barsCAnonStoreyAd = new ProfilerTimelineGUI.\u003CCalculateBars\u003Ec__AnonStoreyAD();
   // ISSUE: reference to a compiler-generated field
   // ISSUE: reference to a compiler-generated field
   // ISSUE: reference to a compiler-generated field
   // ISSUE: reference to a compiler-generated field
   for (barsCAnonStoreyAd.i = 0; barsCAnonStoreyAd.i < threadCount; barsCAnonStoreyAd.i = barsCAnonStoreyAd.i + 1)
   {
     // ISSUE: object of a compiler-generated type is created
     // ISSUE: variable of a compiler-generated type
     ProfilerTimelineGUI.\u003CCalculateBars\u003Ec__AnonStoreyAC barsCAnonStoreyAc = new ProfilerTimelineGUI.\u003CCalculateBars\u003Ec__AnonStoreyAC();
     // ISSUE: reference to a compiler-generated field
     barsCAnonStoreyAc.\u003C\u003Ef__ref\u0024173 = barsCAnonStoreyAd;
     // ISSUE: reference to a compiler-generated field
     frameDataIterator.SetRoot(frameIndex, barsCAnonStoreyAd.i);
     // ISSUE: reference to a compiler-generated field
     barsCAnonStoreyAc.groupname = frameDataIterator.GetGroupName();
     // ISSUE: reference to a compiler-generated method
     ProfilerTimelineGUI.GroupInfo groupInfo = this.groups.Find(new Predicate<ProfilerTimelineGUI.GroupInfo>(barsCAnonStoreyAc.\u003C\u003Em__1F5));
     if (groupInfo == null)
     {
       groupInfo = new ProfilerTimelineGUI.GroupInfo();
       // ISSUE: reference to a compiler-generated field
       groupInfo.name = barsCAnonStoreyAc.groupname;
       groupInfo.height = 20f;
       groupInfo.expanded = false;
       groupInfo.threads = new List<ProfilerTimelineGUI.ThreadInfo>();
       this.groups.Add(groupInfo);
       // ISSUE: reference to a compiler-generated field
       // ISSUE: reference to a compiler-generated field
       if (barsCAnonStoreyAc.groupname == string.Empty || barsCAnonStoreyAc.groupname == "Unity Job System")
         groupInfo.expanded = true;
     }
     // ISSUE: reference to a compiler-generated method
     ProfilerTimelineGUI.ThreadInfo threadInfo1 = groupInfo.threads.Find(new Predicate<ProfilerTimelineGUI.ThreadInfo>(barsCAnonStoreyAc.\u003C\u003Em__1F6));
     if (threadInfo1 == null)
     {
       threadInfo1 = new ProfilerTimelineGUI.ThreadInfo();
       threadInfo1.name = frameDataIterator.GetThreadName();
       threadInfo1.height = 0.0f;
       ProfilerTimelineGUI.ThreadInfo threadInfo2 = threadInfo1;
       ProfilerTimelineGUI.ThreadInfo threadInfo3 = threadInfo1;
       int num2 = !groupInfo.expanded ? 0 : 1;
       double num3;
       float num4 = (float) (num3 = (double) num2);
       threadInfo3.desiredWeight = (float) num3;
       double num5 = (double) num4;
       threadInfo2.weight = (float) num5;
       // ISSUE: reference to a compiler-generated field
       threadInfo1.threadIndex = barsCAnonStoreyAd.i;
       groupInfo.threads.Add(threadInfo1);
     }
     if ((double) threadInfo1.weight != (double) threadInfo1.desiredWeight)
       threadInfo1.weight = (float) ((double) threadInfo1.desiredWeight * (double) time + (1.0 - (double) threadInfo1.desiredWeight) * (1.0 - (double) time));
     num1 += threadInfo1.weight;
   }
   float num6 = 16f * (float) groupCount;
   float num7 = (r.height - num6) / (num1 + 2f);
   using (List<ProfilerTimelineGUI.GroupInfo>.Enumerator enumerator1 = this.groups.GetEnumerator())
   {
     while (enumerator1.MoveNext())
     {
       using (List<ProfilerTimelineGUI.ThreadInfo>.Enumerator enumerator2 = enumerator1.Current.threads.GetEnumerator())
       {
         while (enumerator2.MoveNext())
         {
           ProfilerTimelineGUI.ThreadInfo current = enumerator2.Current;
           current.height = num7 * current.weight;
         }
       }
     }
   }
   this.groups[0].expanded = true;
   this.groups[0].height = 0.0f;
   this.groups[0].threads[0].height = 3f * num7;
 }
Beispiel #4
0
        private void CalculateBars(ref ProfilerFrameDataIterator iter, Rect r, int frameIndex, float time)
        {
            float num = 0f;

            iter.SetRoot(frameIndex, 0);
            int threadCount = iter.GetThreadCount(frameIndex);
            int i;

            for (i = 0; i < threadCount; i++)
            {
                iter.SetRoot(frameIndex, i);
                string groupname = iter.GetGroupName();
                ProfilerTimelineGUI.GroupInfo groupInfo = this.groups.Find((ProfilerTimelineGUI.GroupInfo g) => g.name == groupname);
                if (groupInfo == null)
                {
                    groupInfo          = new ProfilerTimelineGUI.GroupInfo();
                    groupInfo.name     = groupname;
                    groupInfo.height   = 20f;
                    groupInfo.expanded = false;
                    groupInfo.threads  = new List <ProfilerTimelineGUI.ThreadInfo>();
                    this.groups.Add(groupInfo);
                }
                List <ProfilerTimelineGUI.ThreadInfo> threads    = groupInfo.threads;
                ProfilerTimelineGUI.ThreadInfo        threadInfo = threads.Find((ProfilerTimelineGUI.ThreadInfo t) => t.threadIndex == i);
                if (threadInfo == null)
                {
                    threadInfo             = new ProfilerTimelineGUI.ThreadInfo();
                    threadInfo.name        = iter.GetThreadName();
                    threadInfo.height      = 0f;
                    threadInfo.weight      = (threadInfo.desiredWeight = (float)((!groupInfo.expanded) ? 0 : 1));
                    threadInfo.threadIndex = i;
                    groupInfo.threads.Add(threadInfo);
                }
                threadInfo.alive = true;
                if (threadInfo.weight != threadInfo.desiredWeight)
                {
                    threadInfo.weight = threadInfo.desiredWeight * time + (1f - threadInfo.desiredWeight) * (1f - time);
                }
                num += threadInfo.weight;
            }
            float num2 = 0f;

            foreach (ProfilerTimelineGUI.GroupInfo current in this.groups)
            {
                if (current.threads.Count > 1)
                {
                    num2 += (current.expanded ? Math.Max(current.height, (float)current.threads.Count * 2f) : current.height);
                }
            }
            float num3 = r.height - num2;
            float num4 = num3 / (num + 1f);

            foreach (ProfilerTimelineGUI.GroupInfo current2 in this.groups)
            {
                foreach (ProfilerTimelineGUI.ThreadInfo current3 in current2.threads)
                {
                    current3.height = num4 * current3.weight;
                }
            }
            this.groups[0].expanded = true;
            this.groups[0].height   = 0f;
            if (this.groups[0].threads.Count > 0)
            {
                this.groups[0].threads[0].height = 2f * num4;
            }
        }
Beispiel #5
0
        private void CalculateBars(Rect r, int frameIndex, float time)
        {
            ProfilerFrameDataIterator frameDataIterator = new ProfilerFrameDataIterator();
            int   groupCount = frameDataIterator.GetGroupCount(frameIndex);
            float num1       = 0.0f;

            frameDataIterator.SetRoot(frameIndex, 0);
            int threadCount = frameDataIterator.GetThreadCount(frameIndex);

            // ISSUE: object of a compiler-generated type is created
            // ISSUE: variable of a compiler-generated type
            ProfilerTimelineGUI.\u003CCalculateBars\u003Ec__AnonStoreyAD barsCAnonStoreyAd = new ProfilerTimelineGUI.\u003CCalculateBars\u003Ec__AnonStoreyAD();
            // ISSUE: reference to a compiler-generated field
            // ISSUE: reference to a compiler-generated field
            // ISSUE: reference to a compiler-generated field
            // ISSUE: reference to a compiler-generated field
            for (barsCAnonStoreyAd.i = 0; barsCAnonStoreyAd.i < threadCount; barsCAnonStoreyAd.i = barsCAnonStoreyAd.i + 1)
            {
                // ISSUE: object of a compiler-generated type is created
                // ISSUE: variable of a compiler-generated type
                ProfilerTimelineGUI.\u003CCalculateBars\u003Ec__AnonStoreyAC barsCAnonStoreyAc = new ProfilerTimelineGUI.\u003CCalculateBars\u003Ec__AnonStoreyAC();
                // ISSUE: reference to a compiler-generated field
                barsCAnonStoreyAc.\u003C\u003Ef__ref\u0024173 = barsCAnonStoreyAd;
                // ISSUE: reference to a compiler-generated field
                frameDataIterator.SetRoot(frameIndex, barsCAnonStoreyAd.i);
                // ISSUE: reference to a compiler-generated field
                barsCAnonStoreyAc.groupname = frameDataIterator.GetGroupName();
                // ISSUE: reference to a compiler-generated method
                ProfilerTimelineGUI.GroupInfo groupInfo = this.groups.Find(new Predicate <ProfilerTimelineGUI.GroupInfo>(barsCAnonStoreyAc.\u003C\u003Em__1F5));
                if (groupInfo == null)
                {
                    groupInfo = new ProfilerTimelineGUI.GroupInfo();
                    // ISSUE: reference to a compiler-generated field
                    groupInfo.name     = barsCAnonStoreyAc.groupname;
                    groupInfo.height   = 20f;
                    groupInfo.expanded = false;
                    groupInfo.threads  = new List <ProfilerTimelineGUI.ThreadInfo>();
                    this.groups.Add(groupInfo);
                    // ISSUE: reference to a compiler-generated field
                    // ISSUE: reference to a compiler-generated field
                    if (barsCAnonStoreyAc.groupname == string.Empty || barsCAnonStoreyAc.groupname == "Unity Job System")
                    {
                        groupInfo.expanded = true;
                    }
                }
                // ISSUE: reference to a compiler-generated method
                ProfilerTimelineGUI.ThreadInfo threadInfo1 = groupInfo.threads.Find(new Predicate <ProfilerTimelineGUI.ThreadInfo>(barsCAnonStoreyAc.\u003C\u003Em__1F6));
                if (threadInfo1 == null)
                {
                    threadInfo1        = new ProfilerTimelineGUI.ThreadInfo();
                    threadInfo1.name   = frameDataIterator.GetThreadName();
                    threadInfo1.height = 0.0f;
                    ProfilerTimelineGUI.ThreadInfo threadInfo2 = threadInfo1;
                    ProfilerTimelineGUI.ThreadInfo threadInfo3 = threadInfo1;
                    int    num2 = !groupInfo.expanded ? 0 : 1;
                    double num3;
                    float  num4 = (float)(num3 = (double)num2);
                    threadInfo3.desiredWeight = (float)num3;
                    double num5 = (double)num4;
                    threadInfo2.weight = (float)num5;
                    // ISSUE: reference to a compiler-generated field
                    threadInfo1.threadIndex = barsCAnonStoreyAd.i;
                    groupInfo.threads.Add(threadInfo1);
                }
                if ((double)threadInfo1.weight != (double)threadInfo1.desiredWeight)
                {
                    threadInfo1.weight = (float)((double)threadInfo1.desiredWeight * (double)time + (1.0 - (double)threadInfo1.desiredWeight) * (1.0 - (double)time));
                }
                num1 += threadInfo1.weight;
            }
            float num6 = 16f * (float)groupCount;
            float num7 = (r.height - num6) / (num1 + 2f);

            using (List <ProfilerTimelineGUI.GroupInfo> .Enumerator enumerator1 = this.groups.GetEnumerator())
            {
                while (enumerator1.MoveNext())
                {
                    using (List <ProfilerTimelineGUI.ThreadInfo> .Enumerator enumerator2 = enumerator1.Current.threads.GetEnumerator())
                    {
                        while (enumerator2.MoveNext())
                        {
                            ProfilerTimelineGUI.ThreadInfo current = enumerator2.Current;
                            current.height = num7 * current.weight;
                        }
                    }
                }
            }
            this.groups[0].expanded          = true;
            this.groups[0].height            = 0.0f;
            this.groups[0].threads[0].height = 3f * num7;
        }