Beispiel #1
0
        private int DrawTreeView(ProfilerProperty property, int id)
        {
            this.m_SelectedIndex = -1;
            bool   enterChildren        = true;
            int    num                  = 0;
            string selectedPropertyPath = ProfilerDriver.selectedPropertyPath;

            while (property.Next(enterChildren))
            {
                string propertyPath = property.propertyPath;
                bool   flag         = (!this.m_DetailPane) ? (propertyPath == selectedPropertyPath) : (this.m_DetailViewSelectedProperty != string.Empty && this.m_DetailViewSelectedProperty == ProfilerHierarchyGUI.DetailViewSelectedPropertyPath(property));
                if (flag)
                {
                    this.m_SelectedIndex = num;
                }
                bool flag2 = Event.current.type != EventType.Layout;
                flag2 &= (this.m_ScrollViewHeight == 0 || ((float)num * 16f <= (float)this.m_ScrollViewHeight + this.m_TextScroll.y && (float)(num + 1) * 16f > this.m_TextScroll.y));
                if (flag2)
                {
                    enterChildren = this.DrawProfileDataItem(property, num, flag, id);
                }
                else
                {
                    enterChildren = (property.HasChildren && this.IsExpanded(propertyPath));
                }
                num++;
            }
            return(num);
        }
        public ProfilerProperty GetDetailedProperty()
        {
            ProfilerProperty rootProfilerProperty = this.m_Window.GetRootProfilerProperty(this.sortType);
            bool             enterChildren        = true;
            string           selectedPropertyPath = ProfilerDriver.selectedPropertyPath;
            ProfilerProperty result;

            while (rootProfilerProperty.Next(enterChildren))
            {
                string propertyPath = rootProfilerProperty.propertyPath;
                if (propertyPath == selectedPropertyPath)
                {
                    ProfilerProperty profilerProperty = new ProfilerProperty();
                    profilerProperty.InitializeDetailProperty(rootProfilerProperty);
                    result = profilerProperty;
                    return(result);
                }
                if (rootProfilerProperty.HasChildren)
                {
                    enterChildren = this.IsExpanded(propertyPath);
                }
            }
            result = null;
            return(result);
        }
Beispiel #3
0
        private static void SelectObjectsInHierarchyView(ProfilerProperty property)
        {
            int[] instanceIDs = property.instanceIDs;
            List <UnityEngine.Object> list = new List <UnityEngine.Object>();

            int[] array = instanceIDs;
            for (int i = 0; i < array.Length; i++)
            {
                int instanceID               = array[i];
                UnityEngine.Object @object   = EditorUtility.InstanceIDToObject(instanceID);
                Component          component = @object as Component;
                if (component != null)
                {
                    list.Add(component.gameObject);
                }
                else
                {
                    if (@object != null)
                    {
                        list.Add(@object);
                    }
                }
            }
            if (list.Count != 0)
            {
                Selection.objects = list.ToArray();
            }
        }
Beispiel #4
0
        public void DoGUI(ProfilerProperty property, string searchString, bool expandAll)
        {
            this.m_ExpandAll = expandAll;
            this.SetupSplitter();
            this.DoScrolling();
            int controlID = GUIUtility.GetControlID(ProfilerHierarchyGUI.hierarchyViewHash, FocusType.Keyboard);

            this.DrawColumnsHeader(searchString);
            this.m_TextScroll = EditorGUILayout.BeginScrollView(this.m_TextScroll, ProfilerHierarchyGUI.ms_Styles.background, new GUILayoutOption[0]);
            int rowCount = this.DrawProfilingData(property, searchString, controlID);

            property.Cleanup();
            this.UnselectIfClickedOnEmptyArea(rowCount);
            if (Event.current.type == EventType.Repaint)
            {
                this.m_ScrollViewHeight = (int)GUIClip.visibleRect.height;
            }
            GUILayout.EndScrollView();
            this.HandleKeyboard(controlID);
            if (this.m_SetKeyboardFocus && Event.current.type == EventType.Repaint)
            {
                this.m_SetKeyboardFocus    = false;
                GUIUtility.keyboardControl = controlID;
                this.m_Window.Repaint();
            }
        }
Beispiel #5
0
        private int DrawTreeView(ProfilerProperty property, int id)
        {
            this.m_SelectedIndex = -1;
            bool   enterChildren        = true;
            int    rowCount             = 0;
            string selectedPropertyPath = ProfilerDriver.selectedPropertyPath;

            while (property.Next(enterChildren))
            {
                string propertyPath = property.propertyPath;
                bool   selected     = !this.m_DetailPane ? (propertyPath == selectedPropertyPath) : ((this.m_DetailViewSelectedProperty != string.Empty) && (this.m_DetailViewSelectedProperty == DetailViewSelectedPropertyPath(property)));
                if (selected)
                {
                    this.m_SelectedIndex = rowCount;
                }
                bool flag3 = Event.current.type != EventType.Layout;
                if (flag3 & ((this.m_ScrollViewHeight == 0) || (((rowCount * 16f) <= (this.m_ScrollViewHeight + this.m_TextScroll.y)) && (((rowCount + 1) * 16f) > this.m_TextScroll.y))))
                {
                    enterChildren = this.DrawProfileDataItem(property, rowCount, selected, id);
                }
                else
                {
                    enterChildren = property.HasChildren && this.IsExpanded(propertyPath);
                }
                rowCount++;
            }
            return(rowCount);
        }
Beispiel #6
0
        private ProfilerProperty GetDetailedProperty(int frameIndex, ProfilerViewType viewType)
        {
            ProfilerProperty result;

            if (this.m_CachedProfilerPropertyConfig.frameIndex == frameIndex && this.m_CachedProfilerPropertyConfig.sortType == this.m_ProfilerHierarchyGUI.sortType && this.m_CachedProfilerPropertyConfig.viewType == viewType && this.m_CachedProfilerPropertyConfig.propertyPath == ProfilerDriver.selectedPropertyPath)
            {
                result = this.m_CachedProfilerProperty;
            }
            else
            {
                string           selectedPropertyPath = ProfilerDriver.selectedPropertyPath;
                ProfilerProperty detailedProperty     = this.m_MainProfilerHierarchyGUI.GetDetailedProperty();
                if (this.m_CachedProfilerProperty != null)
                {
                    this.m_CachedProfilerProperty.Cleanup();
                }
                this.m_CachedProfilerPropertyConfig.frameIndex   = frameIndex;
                this.m_CachedProfilerPropertyConfig.sortType     = this.m_ProfilerHierarchyGUI.sortType;
                this.m_CachedProfilerPropertyConfig.viewType     = viewType;
                this.m_CachedProfilerPropertyConfig.propertyPath = selectedPropertyPath;
                this.m_CachedProfilerProperty = detailedProperty;
                result = detailedProperty;
            }
            return(result);
        }
Beispiel #7
0
 private static string DetailViewSelectedPropertyPath(ProfilerProperty property)
 {
     if (property == null || property.instanceIDs == null || property.instanceIDs.Length == 0 || property.instanceIDs[0] == 0)
     {
         return(string.Empty);
     }
     return(ProfilerHierarchyGUI.DetailViewSelectedPropertyPath(property, property.instanceIDs[0]));
 }
Beispiel #8
0
 private static string DetailViewSelectedPropertyPath(ProfilerProperty property)
 {
     if (((property != null) && (property.instanceIDs != null)) && ((property.instanceIDs.Length != 0) && (property.instanceIDs[0] != 0)))
     {
         return(DetailViewSelectedPropertyPath(property, property.instanceIDs[0]));
     }
     return(string.Empty);
 }
Beispiel #9
0
 private static string DetailViewSelectedPropertyPath(ProfilerProperty property)
 {
     if (((property == null) || (property.instanceIDs == null)) || ((property.instanceIDs.Length == 0) || (property.instanceIDs[0] == 0)))
     {
         return(string.Empty);
     }
     return(DetailViewSelectedPropertyPath(property, property.instanceIDs[0]));
 }
Beispiel #10
0
 public void ClearCache()
 {
     if (this.m_CachedProfilerProperty != null)
     {
         this.m_CachedProfilerProperty.Cleanup();
         this.m_CachedProfilerProperty = null;
     }
     this.m_CachedProfilerPropertyConfig.frameIndex = -1;
 }
 private void MoveSelection(int steps)
 {
     if (this.IsSearchActive())
     {
         this.m_SearchResults.MoveSelection(steps, this);
     }
     else
     {
         int num1 = this.m_SelectedIndex + steps;
         if (num1 < 0)
         {
             num1 = 0;
         }
         ProfilerProperty property = this.m_Window.CreateProperty(this.m_DetailPane);
         if (this.m_DetailPane)
         {
             ProfilerProperty detailedProperty = this.GetDetailedProperty(property);
             property.Cleanup();
             property = detailedProperty;
         }
         if (property == null)
         {
             return;
         }
         bool enterChildren = true;
         int  num2          = 0;
         int  instanceId    = -1;
         while (property.Next(enterChildren))
         {
             if (this.m_DetailPane && property.instanceIDs != null && (property.instanceIDs.Length > 0 && property.instanceIDs[0] != 0))
             {
                 instanceId = property.instanceIDs[0];
             }
             if (num2 != num1)
             {
                 if (property.HasChildren)
                 {
                     enterChildren = !this.m_DetailPane && this.IsExpanded(property.propertyPath);
                 }
                 ++num2;
             }
             else
             {
                 break;
             }
         }
         if (this.m_DetailPane)
         {
             this.m_DetailViewSelectedProperty = ProfilerHierarchyGUI.DetailViewSelectedPropertyPath(property, instanceId);
         }
         else
         {
             this.m_Window.SetSelectedPropertyPath(property.propertyPath);
         }
         property.Cleanup();
     }
 }
 public void Filter(ProfilerProperty property, ProfilerColumn[] columns, string searchString, int frameIndex, ProfilerColumn sortType)
 {
     if (!(searchString == this.m_LastSearchString) || frameIndex != this.m_LastFrameIndex || sortType != this.m_LastSortType)
     {
         this.m_LastSearchString = searchString;
         this.m_LastFrameIndex   = frameIndex;
         this.m_LastSortType     = sortType;
         this.IterateProfilingData(property, columns, searchString);
     }
 }
Beispiel #13
0
 private int DrawSearchResult(ProfilerProperty property, string searchString, int id)
 {
     if (!this.AllowSearching())
     {
         this.DoSearchingDisabledInfoGUI();
         return(0);
     }
     this.m_SearchResults.Filter(property, this.m_ColumnsToShow, searchString, this.m_Window.GetActiveVisibleFrameIndex(), this.sortType);
     this.m_SearchResults.Draw(this, id);
     return(this.m_SearchResults.numRows);
 }
			public void Filter(ProfilerProperty property, ProfilerColumn[] columns, string searchString, int frameIndex, ProfilerColumn sortType)
			{
				if (searchString == this.m_LastSearchString && frameIndex == this.m_LastFrameIndex && sortType == this.m_LastSortType)
				{
					return;
				}
				this.m_LastSearchString = searchString;
				this.m_LastFrameIndex = frameIndex;
				this.m_LastSortType = sortType;
				this.IterateProfilingData(property, columns, searchString);
			}
Beispiel #15
0
 public void Filter(ProfilerProperty property, ProfilerColumn[] columns, string searchString, int frameIndex, ProfilerColumn sortType)
 {
     if (searchString == this.m_LastSearchString && frameIndex == this.m_LastFrameIndex && sortType == this.m_LastSortType)
     {
         return;
     }
     this.m_LastSearchString = searchString;
     this.m_LastFrameIndex   = frameIndex;
     this.m_LastSortType     = sortType;
     this.IterateProfilingData(property, columns, searchString);
 }
        private int DrawProfilingData(ProfilerProperty property, string searchString, int id)
        {
            int num = !this.IsSearchActive() ? this.DrawTreeView(property, id) : this.DrawSearchResult(property, searchString, id);

            if (num == 0)
            {
                Rect rowRect = this.GetRowRect(0);
                rowRect.height = 1f;
                GUI.Label(rowRect, GUIContent.none, ProfilerHierarchyGUI.styles.entryEven);
            }
            return(num);
        }
        public static CPUElement Create(UnityEditorInternal.ProfilerProperty root)
        {
            allCPUEle = new List <CPUElement>();
            if (allCPUEle == null)
            {
                return(null);
            }
            if (root == null)
            {
                return(null);
            }
            CPUElement rootEle = new CPUElement()
            {
                FunctionName   = root.propertyName,
                TotalPercent   = root.GetColumn(ProfilerColumn.TotalPercent),
                SelfPercent    = root.GetColumn(ProfilerColumn.SelfPercent),
                Calls          = root.GetColumn(ProfilerColumn.Calls),
                GCMemory       = root.GetColumn(ProfilerColumn.GCMemory),
                TotalTime      = root.GetColumn(ProfilerColumn.TotalTime),
                SelfTime       = root.GetColumn(ProfilerColumn.SelfTime),
                RelatedObjName = root.GetColumn(ProfilerColumn.ObjectName),
                Depth          = root.depth
            };

            if (allCPUEle != null)
            {
                allCPUEle.Add(rootEle);
            }

            while (root.Next(root.HasChildren))
            {
                CPUElement ele = new CPUElement()
                {
                    FunctionName   = root.propertyName,
                    TotalPercent   = root.GetColumn(ProfilerColumn.TotalPercent),
                    SelfPercent    = root.GetColumn(ProfilerColumn.SelfPercent),
                    Calls          = root.GetColumn(ProfilerColumn.Calls),
                    GCMemory       = root.GetColumn(ProfilerColumn.GCMemory),
                    TotalTime      = root.GetColumn(ProfilerColumn.TotalTime),
                    SelfTime       = root.GetColumn(ProfilerColumn.SelfTime),
                    RelatedObjName = root.GetColumn(ProfilerColumn.ObjectName),
                    Depth          = root.depth
                };
                if (allCPUEle != null)
                {
                    allCPUEle.Add(ele);
                }
            }

            SetChildren();
            return(rootEle);
        }
Beispiel #18
0
        public void DoGUI(GUIStyle headerStyle, int frameIndex, ProfilerViewType viewType)
        {
            ProfilerProperty detailedProperty = this.GetDetailedProperty(frameIndex, viewType);

            if (detailedProperty != null)
            {
                this.m_ProfilerHierarchyGUI.DoGUI(detailedProperty, string.Empty, false);
            }
            else
            {
                this.DrawEmptyPane(headerStyle);
            }
        }
        private static string DetailViewSelectedPropertyPath(ProfilerProperty property)
        {
            string result;

            if (property == null || property.instanceIDs == null || property.instanceIDs.Length == 0 || property.instanceIDs[0] == 0)
            {
                result = string.Empty;
            }
            else
            {
                result = ProfilerHierarchyGUI.DetailViewSelectedPropertyPath(property, property.instanceIDs[0]);
            }
            return(result);
        }
        public static GPUElement Create(UnityEditorInternal.ProfilerProperty root)
        {
            allGPUEle = new List <GPUElement>();
            if (allGPUEle == null)
            {
                return(null);
            }
            if (root == null)
            {
                return(null);
            }
            GPUElement rootEle = new GPUElement
            {
                FuncName        = root.propertyName,
                TotalGPUPercent = root.GetColumn(ProfilerColumn.TotalGPUPercent),
                SelfGPUPercent  = root.GetColumn(ProfilerColumn.SelfGPUPercent),
                DrawCalls       = root.GetColumn(ProfilerColumn.DrawCalls),
                TotalGPUTime    = root.GetColumn(ProfilerColumn.TotalGPUTime),
                SelfGPUTime     = root.GetColumn(ProfilerColumn.SelfGPUTime),
                RelatedObjName  = root.GetColumn(ProfilerColumn.ObjectName),
                Depth           = root.depth
            };

            if (allGPUEle != null)
            {
                allGPUEle.Add(rootEle);
            }

            while (root.Next(root.HasChildren))
            {
                GPUElement ele = new GPUElement
                {
                    FuncName        = root.propertyName,
                    TotalGPUPercent = root.GetColumn(ProfilerColumn.TotalGPUPercent),
                    DrawCalls       = root.GetColumn(ProfilerColumn.DrawCalls),
                    TotalGPUTime    = root.GetColumn(ProfilerColumn.TotalGPUTime),
                    RelatedObjName  = root.GetColumn(ProfilerColumn.ObjectName),
                    Depth           = root.depth
                };
                if (allGPUEle != null)
                {
                    allGPUEle.Add(ele);
                }
            }

            SetChildren();
            return(rootEle);
        }
 private void MoveSelection(int steps)
 {
     if (this.IsSearchActive())
     {
         this.m_SearchResults.MoveSelection(steps, this);
     }
     else
     {
         int num = this.m_SelectedIndex + steps;
         if (num < 0)
         {
             num = 0;
         }
         ProfilerProperty profilerProperty = (!this.m_DetailPane) ? this.m_Window.GetRootProfilerProperty(this.m_SortType) : this.GetDetailedProperty();
         if (profilerProperty != null)
         {
             bool enterChildren = true;
             int  num2          = 0;
             int  instanceId    = -1;
             while (profilerProperty.Next(enterChildren))
             {
                 if (this.m_DetailPane && profilerProperty.instanceIDs != null && profilerProperty.instanceIDs.Length > 0 && profilerProperty.instanceIDs[0] != 0)
                 {
                     instanceId = profilerProperty.instanceIDs[0];
                 }
                 if (num2 == num)
                 {
                     break;
                 }
                 if (profilerProperty.HasChildren)
                 {
                     enterChildren = (!this.m_DetailPane && this.IsExpanded(profilerProperty.propertyPath));
                 }
                 num2++;
             }
             if (this.m_DetailPane)
             {
                 this.m_DetailViewSelectedProperty = ProfilerHierarchyGUI.DetailViewSelectedPropertyPath(profilerProperty, instanceId);
             }
             else
             {
                 this.m_Window.SetSelectedPropertyPath(profilerProperty.propertyPath);
             }
         }
     }
 }
        private int DrawTreeView(ProfilerProperty property, int id)
        {
            this.m_SelectedIndex = -1;
            bool   enterChildren        = true;
            int    rowCount             = 0;
            string selectedPropertyPath = ProfilerDriver.selectedPropertyPath;

            while (property.Next(enterChildren))
            {
                string propertyPath = property.propertyPath;
                bool   selected     = !this.m_DetailPane ? propertyPath == selectedPropertyPath : this.m_DetailViewSelectedProperty != string.Empty && this.m_DetailViewSelectedProperty == ProfilerHierarchyGUI.DetailViewSelectedPropertyPath(property);
                if (selected)
                {
                    this.m_SelectedIndex = rowCount;
                }
                enterChildren = ((Event.current.type != EventType.Layout ? 1 : 0) & (this.m_ScrollViewHeight == 0 ? 1 : ((double)rowCount * 16.0 > (double)this.m_ScrollViewHeight + (double)this.m_TextScroll.y ? 0 : ((double)(rowCount + 1) * 16.0 > (double)this.m_TextScroll.y ? 1 : 0)))) == 0 ? property.HasChildren && this.IsExpanded(propertyPath) : this.DrawProfileDataItem(property, rowCount, selected, id);
                ++rowCount;
            }
            return(rowCount);
        }
Beispiel #23
0
        public ProfilerProperty GetDetailedProperty(ProfilerProperty property)
        {
            bool   enterChildren        = true;
            string selectedPropertyPath = ProfilerDriver.selectedPropertyPath;

            while (property.Next(enterChildren))
            {
                string propertyPath = property.propertyPath;
                if (propertyPath == selectedPropertyPath)
                {
                    ProfilerProperty profilerProperty = new ProfilerProperty();
                    profilerProperty.InitializeDetailProperty(property);
                    return(profilerProperty);
                }
                if (property.HasChildren)
                {
                    enterChildren = this.IsExpanded(propertyPath);
                }
            }
            return(null);
        }
Beispiel #24
0
        private ProfilerProperty GetDetailedProperty(int frameIndex, ProfilerViewType viewType, ProfilerColumn sortType)
        {
            ProfilerProperty result;

            if (this.m_CachedProfilerPropertyConfig.EqualsTo(frameIndex, viewType, sortType))
            {
                result = this.m_CachedProfilerProperty;
            }
            else
            {
                ProfilerProperty detailedProperty = this.m_MainProfilerHierarchyGUI.GetDetailedProperty();
                if (this.m_CachedProfilerProperty != null)
                {
                    this.m_CachedProfilerProperty.Cleanup();
                }
                this.m_CachedProfilerPropertyConfig.Set(frameIndex, viewType, sortType);
                this.m_CachedProfilerProperty = detailedProperty;
                result = detailedProperty;
            }
            return(result);
        }
Beispiel #25
0
        private static void SelectObjectsInHierarchyView(ProfilerProperty property)
        {
            int[]         instanceIDs = property.instanceIDs;
            List <Object> list        = new List <Object>();

            foreach (int num in instanceIDs)
            {
                Object    item      = EditorUtility.InstanceIDToObject(num);
                Component component = item as Component;
                if (component != null)
                {
                    list.Add(component.gameObject);
                }
                else if (item != null)
                {
                    list.Add(item);
                }
            }
            if (list.Count != 0)
            {
                Selection.objects = list.ToArray();
            }
        }
        private static void SelectObjectsInHierarchyView(ProfilerProperty property)
        {
            int[] instanceIds = property.instanceIDs;
            List <UnityEngine.Object> objectList = new List <UnityEngine.Object>();

            foreach (int instanceID in instanceIds)
            {
                UnityEngine.Object @object   = EditorUtility.InstanceIDToObject(instanceID);
                Component          component = @object as Component;
                if ((UnityEngine.Object)component != (UnityEngine.Object)null)
                {
                    objectList.Add((UnityEngine.Object)component.gameObject);
                }
                else if (@object != (UnityEngine.Object)null)
                {
                    objectList.Add(@object);
                }
            }
            if (objectList.Count == 0)
            {
                return;
            }
            Selection.objects = objectList.ToArray();
        }
Beispiel #27
0
            private void IterateProfilingData(ProfilerProperty property, ProfilerColumn[] columns, string searchString)
            {
                this.m_NumResultsUsed      = 0;
                this.m_ColumnsToShow       = columns;
                this.m_FoundAllResults     = true;
                this.m_SelectedSearchIndex = -1;
                int    num = 0;
                string selectedPropertyPath = ProfilerDriver.selectedPropertyPath;

                while (property.Next(true))
                {
                    if (num >= this.m_SearchResults.Length)
                    {
                        this.m_FoundAllResults = false;
                        break;
                    }
                    string propertyPath = property.propertyPath;
                    int    startIndex   = Mathf.Max(propertyPath.LastIndexOf('/'), 0);
                    if (propertyPath.IndexOf(searchString, startIndex, StringComparison.CurrentCultureIgnoreCase) > -1)
                    {
                        string[] array = new string[this.m_ColumnsToShow.Length];
                        for (int i = 0; i < this.m_ColumnsToShow.Length; i++)
                        {
                            array[i] = property.GetColumn(this.m_ColumnsToShow[i]);
                        }
                        this.m_SearchResults[num].propertyPath = propertyPath;
                        this.m_SearchResults[num].columnValues = array;
                        if (propertyPath == selectedPropertyPath)
                        {
                            this.m_SelectedSearchIndex = num;
                        }
                        num++;
                    }
                }
                this.m_NumResultsUsed = num;
            }
 private int DrawTreeView(ProfilerProperty property, int id)
 {
     this.m_SelectedIndex = -1;
     bool enterChildren = true;
     int rowCount = 0;
     string selectedPropertyPath = ProfilerDriver.selectedPropertyPath;
     while (property.Next(enterChildren))
     {
         string propertyPath = property.propertyPath;
         bool selected = !this.m_DetailPane ? (propertyPath == selectedPropertyPath) : ((this.m_DetailViewSelectedProperty != string.Empty) && (this.m_DetailViewSelectedProperty == DetailViewSelectedPropertyPath(property)));
         if (selected)
         {
             this.m_SelectedIndex = rowCount;
         }
         bool flag3 = Event.current.type != EventType.Layout;
         if (flag3 & ((this.m_ScrollViewHeight == 0) || (((rowCount * 16f) <= (this.m_ScrollViewHeight + this.m_TextScroll.y)) && (((rowCount + 1) * 16f) > this.m_TextScroll.y))))
         {
             enterChildren = this.DrawProfileDataItem(property, rowCount, selected, id);
         }
         else
         {
             enterChildren = property.HasChildren && this.IsExpanded(propertyPath);
         }
         rowCount++;
     }
     return rowCount;
 }
 private bool DrawProfileDataItem(ProfilerProperty property, int rowCount, bool selected, int id)
 {
     bool flag = false;
     Event current = Event.current;
     Rect rowRect = this.GetRowRect(rowCount);
     Rect position = rowRect;
     GUIStyle rowBackgroundStyle = this.GetRowBackgroundStyle(rowCount);
     if (current.type == EventType.Repaint)
     {
         rowBackgroundStyle.Draw(position, GUIContent.none, false, false, selected, false);
     }
     float x = (property.depth * 16f) + 4f;
     if (property.HasChildren)
     {
         flag = this.IsExpanded(property.propertyPath);
         GUI.changed = false;
         x -= 14f;
         Rect rect3 = new Rect(x, position.y, 14f, 16f);
         flag = GUI.Toggle(rect3, flag, GUIContent.none, styles.foldout);
         if (GUI.changed)
         {
             this.SetExpanded(property, flag);
         }
         x += 16f;
     }
     string column = property.GetColumn(this.m_ColumnsToShow[0]);
     if (current.type == EventType.Repaint)
     {
         this.DrawTextColumn(ref position, column, 0, (this.m_ColumnsToShow[0] != ProfilerColumn.FunctionName) ? 4f : x, selected);
     }
     if (ProfilerInstrumentationPopup.InstrumentationEnabled && ProfilerInstrumentationPopup.FunctionHasInstrumentationPopup(column))
     {
         float num2 = ((position.x + x) + 5f) + styles.numberLabel.CalcSize(new GUIContent(column)).x;
         num2 = Mathf.Clamp(num2, 0f, (this.m_Splitter.realSizes[0] - 30f) + 2f);
         Rect rect4 = new Rect(num2, position.y, 30f, 16f);
         if (GUI.Button(rect4, styles.instrumentationIcon, styles.miniPullDown))
         {
             ProfilerInstrumentationPopup.Show(rect4, column);
         }
     }
     if (current.type == EventType.Repaint)
     {
         styles.numberLabel.alignment = TextAnchor.MiddleRight;
         int index = 1;
         for (int i = 1; i < this.m_VisibleColumns.Length; i++)
         {
             if (this.ColIsVisible(i))
             {
                 position.x += this.m_Splitter.realSizes[index - 1];
                 position.width = this.m_Splitter.realSizes[index] - 4f;
                 index++;
                 styles.numberLabel.Draw(position, property.GetColumn(this.m_ColumnsToShow[i]), false, false, false, selected);
             }
         }
         styles.numberLabel.alignment = TextAnchor.MiddleLeft;
     }
     if ((current.type == EventType.MouseDown) && rowRect.Contains(current.mousePosition))
     {
         GUIUtility.hotControl = 0;
         if (!EditorGUI.actionKey)
         {
             if (this.m_DetailPane)
             {
                 if ((current.clickCount == 1) && (property.instanceIDs.Length > 0))
                 {
                     string str2 = DetailViewSelectedPropertyPath(property);
                     if (this.m_DetailViewSelectedProperty != str2)
                     {
                         this.m_DetailViewSelectedProperty = str2;
                         UnityEngine.Object gameObject = EditorUtility.InstanceIDToObject(property.instanceIDs[0]);
                         if (gameObject is Component)
                         {
                             gameObject = ((Component) gameObject).gameObject;
                         }
                         if (gameObject != null)
                         {
                             EditorGUIUtility.PingObject(gameObject.GetInstanceID());
                         }
                     }
                     else
                     {
                         this.m_DetailViewSelectedProperty = string.Empty;
                     }
                 }
                 else if (current.clickCount == 2)
                 {
                     SelectObjectsInHierarchyView(property);
                     this.m_DetailViewSelectedProperty = DetailViewSelectedPropertyPath(property);
                 }
             }
             else
             {
                 this.RowMouseDown(property.propertyPath);
             }
             this.DoScroll();
         }
         else if (!this.m_DetailPane)
         {
             this.m_Window.ClearSelectedPropertyPath();
         }
         else
         {
             this.m_DetailViewSelectedProperty = string.Empty;
         }
         GUIUtility.keyboardControl = id;
         current.Use();
     }
     if (((selected && (GUIUtility.keyboardControl == id)) && (current.type == EventType.KeyDown)) && ((current.keyCode == KeyCode.Return) || (current.keyCode == KeyCode.KeypadEnter)))
     {
         SelectObjectsInHierarchyView(property);
     }
     return flag;
 }
 private static void SelectObjectsInHierarchyView(ProfilerProperty property)
 {
   int[] instanceIds = property.instanceIDs;
   List<UnityEngine.Object> objectList = new List<UnityEngine.Object>();
   foreach (int instanceID in instanceIds)
   {
     UnityEngine.Object @object = EditorUtility.InstanceIDToObject(instanceID);
     Component component = @object as Component;
     if ((UnityEngine.Object) component != (UnityEngine.Object) null)
       objectList.Add((UnityEngine.Object) component.gameObject);
     else if (@object != (UnityEngine.Object) null)
       objectList.Add(@object);
   }
   if (objectList.Count == 0)
     return;
   Selection.objects = objectList.ToArray();
 }
 public void Filter(ProfilerProperty property, ProfilerColumn[] columns, string searchString, int frameIndex, ProfilerColumn sortType)
 {
     if (((searchString != this.m_LastSearchString) || (frameIndex != this.m_LastFrameIndex)) || (sortType != this.m_LastSortType))
     {
         this.m_LastSearchString = searchString;
         this.m_LastFrameIndex = frameIndex;
         this.m_LastSortType = sortType;
         this.IterateProfilingData(property, columns, searchString);
     }
 }
		private void DrawCPUOrRenderingToolbar(ProfilerProperty property)
		{
			EditorGUILayout.BeginHorizontal(EditorStyles.toolbar, new GUILayoutOption[0]);
			string[] displayedOptions = new string[]
			{
				"Hierarchy",
				"Timeline",
				"Raw Hierarchy"
			};
			int[] optionValues = new int[]
			{
				0,
				1,
				2
			};
			this.m_ViewType = (ProfilerViewType)EditorGUILayout.IntPopup((int)this.m_ViewType, displayedOptions, optionValues, EditorStyles.toolbarDropDown, new GUILayoutOption[]
			{
				GUILayout.Width(100f)
			});
			GUILayout.FlexibleSpace();
			GUILayout.Label(string.Format("CPU:{0}ms   GPU:{1}ms", property.frameTime, property.frameGpuTime), EditorStyles.miniLabel, new GUILayoutOption[0]);
			GUI.enabled = (ProfilerDriver.GetNextFrameIndex(this.m_CurrentFrame) == -1);
			if (GUILayout.Button((!GUI.enabled) ? ProfilerWindow.ms_Styles.noFrameDebugger : ProfilerWindow.ms_Styles.frameDebugger, EditorStyles.toolbarButton, new GUILayoutOption[0]))
			{
				FrameDebuggerWindow frameDebuggerWindow = FrameDebuggerWindow.ShowFrameDebuggerWindow();
				frameDebuggerWindow.EnableIfNeeded();
			}
			GUI.enabled = true;
			GUILayout.FlexibleSpace();
			this.SearchFieldGUI();
			EditorGUILayout.EndHorizontal();
			this.HandleCommandEvents();
		}
Beispiel #33
0
 private void SetExpanded(ProfilerProperty property, bool expanded)
 {
     this.SetExpanded(property.propertyPath, expanded);
 }
		private static string DetailViewSelectedPropertyPath(ProfilerProperty property, int instanceId)
		{
			return property.propertyPath + "/" + instanceId;
		}
Beispiel #35
0
 public ProfilerProperty CreateProperty(bool details)
 {
     ProfilerProperty property = new ProfilerProperty();
     ProfilerColumn profilerSortColumn = (this.m_CurrentArea != ProfilerArea.CPU) ? (!details ? this.m_GPUHierarchyGUI.sortType : this.m_GPUDetailHierarchyGUI.sortType) : (!details ? this.m_CPUHierarchyGUI.sortType : this.m_CPUDetailHierarchyGUI.sortType);
     property.SetRoot(this.GetActiveVisibleFrameIndex(), profilerSortColumn, this.m_ViewType);
     property.onlyShowGPUSamples = this.m_CurrentArea == ProfilerArea.GPU;
     return property;
 }
		private int DrawTreeView(ProfilerProperty property, int id)
		{
			this.m_SelectedIndex = -1;
			bool enterChildren = true;
			int num = 0;
			string selectedPropertyPath = ProfilerDriver.selectedPropertyPath;
			while (property.Next(enterChildren))
			{
				string propertyPath = property.propertyPath;
				bool flag = (!this.m_DetailPane) ? (propertyPath == selectedPropertyPath) : (this.m_DetailViewSelectedProperty != string.Empty && this.m_DetailViewSelectedProperty == ProfilerHierarchyGUI.DetailViewSelectedPropertyPath(property));
				if (flag)
				{
					this.m_SelectedIndex = num;
				}
				bool flag2 = Event.current.type != EventType.Layout;
				flag2 &= (this.m_ScrollViewHeight == 0 || ((float)num * 16f <= (float)this.m_ScrollViewHeight + this.m_TextScroll.y && (float)(num + 1) * 16f > this.m_TextScroll.y));
				if (flag2)
				{
					enterChildren = this.DrawProfileDataItem(property, num, flag, id);
				}
				else
				{
					enterChildren = (property.HasChildren && this.IsExpanded(propertyPath));
				}
				num++;
			}
			return num;
		}
		private static string DetailViewSelectedPropertyPath(ProfilerProperty property)
		{
			if (property == null || property.instanceIDs == null || property.instanceIDs.Length == 0 || property.instanceIDs[0] == 0)
			{
				return string.Empty;
			}
			return ProfilerHierarchyGUI.DetailViewSelectedPropertyPath(property, property.instanceIDs[0]);
		}
		private int DrawSearchResult(ProfilerProperty property, string searchString, int id)
		{
			if (!this.AllowSearching())
			{
				this.DoSearchingDisabledInfoGUI();
				return 0;
			}
			this.m_SearchResults.Filter(property, this.m_ColumnsToShow, searchString, this.m_Window.GetActiveVisibleFrameIndex(), this.sortType);
			this.m_SearchResults.Draw(this, id);
			return this.m_SearchResults.numRows;
		}
		private int DrawProfilingData(ProfilerProperty property, string searchString, int id)
		{
			int num;
			if (this.IsSearchActive())
			{
				num = this.DrawSearchResult(property, searchString, id);
			}
			else
			{
				num = this.DrawTreeView(property, id);
			}
			if (num == 0)
			{
				Rect rowRect = this.GetRowRect(0);
				rowRect.height = 1f;
				GUI.Label(rowRect, GUIContent.none, ProfilerHierarchyGUI.styles.entryEven);
			}
			return num;
		}
 private bool DrawProfileDataItem(ProfilerProperty property, int rowCount, bool selected, int id)
 {
   bool expanded = false;
   Event current = Event.current;
   Rect rowRect = this.GetRowRect(rowCount);
   Rect currentRect = rowRect;
   GUIStyle rowBackgroundStyle = this.GetRowBackgroundStyle(rowCount);
   if (current.type == EventType.Repaint)
     rowBackgroundStyle.Draw(currentRect, GUIContent.none, false, false, selected, false);
   float num = (float) ((double) property.depth * 16.0 + 4.0);
   if (property.HasChildren)
   {
     bool flag = this.IsExpanded(property.propertyPath);
     GUI.changed = false;
     float x = num - 14f;
     expanded = GUI.Toggle(new Rect(x, currentRect.y, 14f, 16f), flag, GUIContent.none, ProfilerHierarchyGUI.styles.foldout);
     if (GUI.changed)
       this.SetExpanded(property, expanded);
     num = x + 16f;
   }
   string column = property.GetColumn(this.m_ColumnsToShow[0]);
   if (current.type == EventType.Repaint)
     this.DrawTextColumn(ref currentRect, column, 0, this.m_ColumnsToShow[0] != ProfilerColumn.FunctionName ? 4f : num, selected);
   if (ProfilerInstrumentationPopup.InstrumentationEnabled && ProfilerInstrumentationPopup.FunctionHasInstrumentationPopup(column))
   {
     Rect rect = new Rect(Mathf.Clamp((float) ((double) currentRect.x + (double) num + 5.0) + ProfilerHierarchyGUI.styles.numberLabel.CalcSize(new GUIContent(column)).x, 0.0f, (float) ((double) this.m_Splitter.realSizes[0] - 30.0 + 2.0)), currentRect.y, 30f, 16f);
     if (GUI.Button(rect, ProfilerHierarchyGUI.styles.instrumentationIcon, ProfilerHierarchyGUI.styles.miniPullDown))
       ProfilerInstrumentationPopup.Show(rect, column);
   }
   if (current.type == EventType.Repaint)
   {
     ProfilerHierarchyGUI.styles.numberLabel.alignment = TextAnchor.MiddleRight;
     int index1 = 1;
     for (int index2 = 1; index2 < this.m_VisibleColumns.Length; ++index2)
     {
       if (this.ColIsVisible(index2))
       {
         currentRect.x += (float) this.m_Splitter.realSizes[index1 - 1];
         currentRect.width = (float) this.m_Splitter.realSizes[index1] - 4f;
         ++index1;
         ProfilerHierarchyGUI.styles.numberLabel.Draw(currentRect, property.GetColumn(this.m_ColumnsToShow[index2]), false, false, false, selected);
       }
     }
     ProfilerHierarchyGUI.styles.numberLabel.alignment = TextAnchor.MiddleLeft;
   }
   if (current.type == EventType.MouseDown && rowRect.Contains(current.mousePosition))
   {
     GUIUtility.hotControl = 0;
     if (!EditorGUI.actionKey)
     {
       if (this.m_DetailPane)
       {
         if (current.clickCount == 1 && property.instanceIDs.Length > 0)
         {
           string str = ProfilerHierarchyGUI.DetailViewSelectedPropertyPath(property);
           if (this.m_DetailViewSelectedProperty != str)
           {
             this.m_DetailViewSelectedProperty = str;
             UnityEngine.Object gameObject = EditorUtility.InstanceIDToObject(property.instanceIDs[0]);
             if (gameObject is Component)
               gameObject = (UnityEngine.Object) ((Component) gameObject).gameObject;
             if (gameObject != (UnityEngine.Object) null)
               EditorGUIUtility.PingObject(gameObject.GetInstanceID());
           }
           else
             this.m_DetailViewSelectedProperty = string.Empty;
         }
         else if (current.clickCount == 2)
         {
           ProfilerHierarchyGUI.SelectObjectsInHierarchyView(property);
           this.m_DetailViewSelectedProperty = ProfilerHierarchyGUI.DetailViewSelectedPropertyPath(property);
         }
       }
       else
         this.RowMouseDown(property.propertyPath);
       this.DoScroll();
     }
     else if (!this.m_DetailPane)
       this.m_Window.ClearSelectedPropertyPath();
     else
       this.m_DetailViewSelectedProperty = string.Empty;
     GUIUtility.keyboardControl = id;
     current.Use();
   }
   if (selected && GUIUtility.keyboardControl == id && current.type == EventType.KeyDown && (current.keyCode == KeyCode.Return || current.keyCode == KeyCode.KeypadEnter))
     ProfilerHierarchyGUI.SelectObjectsInHierarchyView(property);
   return expanded;
 }
 public extern void InitializeDetailProperty(ProfilerProperty source);
 private static void SelectObjectsInHierarchyView(ProfilerProperty property)
 {
     int[] instanceIDs = property.instanceIDs;
     List<UnityEngine.Object> list = new List<UnityEngine.Object>();
     foreach (int num in instanceIDs)
     {
         UnityEngine.Object item = EditorUtility.InstanceIDToObject(num);
         Component component = item as Component;
         if (component != null)
         {
             list.Add(component.gameObject);
         }
         else if (item != null)
         {
             list.Add(item);
         }
     }
     if (list.Count != 0)
     {
         Selection.objects = list.ToArray();
     }
 }
Beispiel #43
0
 private static bool CheckFrameData(ProfilerProperty property)
 {
     if (!property.frameDataReady)
     {
         GUILayout.Label(ms_Styles.noData, ms_Styles.background, new GUILayoutOption[0]);
         return false;
     }
     return true;
 }
		private bool DrawProfileDataItem(ProfilerProperty property, int rowCount, bool selected, int id)
		{
			bool flag = false;
			Event current = Event.current;
			Rect rowRect = this.GetRowRect(rowCount);
			Rect position = rowRect;
			GUIStyle rowBackgroundStyle = this.GetRowBackgroundStyle(rowCount);
			if (current.type == EventType.Repaint)
			{
				rowBackgroundStyle.Draw(position, GUIContent.none, false, false, selected, false);
			}
			float num = (float)property.depth * 16f + 4f;
			if (property.HasChildren)
			{
				flag = this.IsExpanded(property.propertyPath);
				GUI.changed = false;
				num -= 14f;
				Rect position2 = new Rect(num, position.y, 14f, 16f);
				flag = GUI.Toggle(position2, flag, GUIContent.none, ProfilerHierarchyGUI.styles.foldout);
				if (GUI.changed)
				{
					this.SetExpanded(property, flag);
				}
				num += 16f;
			}
			if (current.type == EventType.Repaint)
			{
				this.DrawTextColumn(ref position, property.GetColumn(this.m_ColumnsToShow[0]), 0, (this.m_ColumnsToShow[0] != ProfilerColumn.FunctionName) ? 4f : num, selected);
				ProfilerHierarchyGUI.styles.numberLabel.alignment = TextAnchor.MiddleRight;
				int num2 = 1;
				for (int i = 1; i < this.m_VisibleColumns.Length; i++)
				{
					if (this.ColIsVisible(i))
					{
						position.x += (float)this.m_Splitter.realSizes[num2 - 1];
						position.width = (float)this.m_Splitter.realSizes[num2] - 4f;
						num2++;
						ProfilerHierarchyGUI.styles.numberLabel.Draw(position, property.GetColumn(this.m_ColumnsToShow[i]), false, false, false, selected);
					}
				}
				ProfilerHierarchyGUI.styles.numberLabel.alignment = TextAnchor.MiddleLeft;
			}
			if (current.type == EventType.MouseDown && rowRect.Contains(current.mousePosition))
			{
				GUIUtility.hotControl = 0;
				if (!EditorGUI.actionKey)
				{
					if (this.m_DetailPane)
					{
						if (current.clickCount == 1 && property.instanceIDs.Length > 0)
						{
							string text = ProfilerHierarchyGUI.DetailViewSelectedPropertyPath(property);
							if (this.m_DetailViewSelectedProperty != text)
							{
								this.m_DetailViewSelectedProperty = text;
								UnityEngine.Object @object = EditorUtility.InstanceIDToObject(property.instanceIDs[0]);
								if (@object is Component)
								{
									@object = ((Component)@object).gameObject;
								}
								if (@object != null)
								{
									EditorGUIUtility.PingObject(@object.GetInstanceID());
								}
							}
							else
							{
								this.m_DetailViewSelectedProperty = string.Empty;
							}
						}
						else
						{
							if (current.clickCount == 2)
							{
								ProfilerHierarchyGUI.SelectObjectsInHierarchyView(property);
								this.m_DetailViewSelectedProperty = ProfilerHierarchyGUI.DetailViewSelectedPropertyPath(property);
							}
						}
					}
					else
					{
						this.RowMouseDown(property.propertyPath);
					}
					this.DoScroll();
				}
				else
				{
					if (!this.m_DetailPane)
					{
						this.m_Window.ClearSelectedPropertyPath();
					}
					else
					{
						this.m_DetailViewSelectedProperty = string.Empty;
					}
				}
				GUIUtility.keyboardControl = id;
				current.Use();
			}
			if (selected && GUIUtility.keyboardControl == id && current.type == EventType.KeyDown && (current.keyCode == KeyCode.Return || current.keyCode == KeyCode.KeypadEnter))
			{
				ProfilerHierarchyGUI.SelectObjectsInHierarchyView(property);
			}
			return flag;
		}
Beispiel #45
0
 private void DrawCPUOrRenderingToolbar(ProfilerProperty property)
 {
     EditorGUILayout.BeginHorizontal(EditorStyles.toolbar, new GUILayoutOption[0]);
     string[] displayedOptions = new string[] { "Hierarchy", "Timeline", "Raw Hierarchy" };
     int[] numArray1 = new int[3];
     numArray1[1] = 1;
     numArray1[2] = 2;
     int[] optionValues = numArray1;
     GUILayoutOption[] options = new GUILayoutOption[] { GUILayout.Width(100f) };
     this.m_ViewType = (ProfilerViewType) EditorGUILayout.IntPopup((int) this.m_ViewType, displayedOptions, optionValues, EditorStyles.toolbarDropDown, options);
     GUILayout.FlexibleSpace();
     GUILayout.Label(string.Format("CPU:{0}ms   GPU:{1}ms", property.frameTime, property.frameGpuTime), EditorStyles.miniLabel, new GUILayoutOption[0]);
     GUI.enabled = ProfilerDriver.GetNextFrameIndex(this.m_CurrentFrame) == -1;
     if (GUILayout.Button(!GUI.enabled ? ms_Styles.noFrameDebugger : ms_Styles.frameDebugger, EditorStyles.toolbarButton, new GUILayoutOption[0]))
     {
         FrameDebuggerWindow.ShowFrameDebuggerWindow().EnableIfNeeded();
     }
     GUI.enabled = true;
     if (ProfilerInstrumentationPopup.InstrumentationEnabled && GUILayout.Button(ms_Styles.profilerInstrumentation, EditorStyles.toolbarDropDown, new GUILayoutOption[0]))
     {
         ProfilerInstrumentationPopup.Show(GUILayoutUtility.topLevel.GetLast());
     }
     GUILayout.FlexibleSpace();
     this.SearchFieldGUI();
     EditorGUILayout.EndHorizontal();
     this.HandleCommandEvents();
 }
		private static void SelectObjectsInHierarchyView(ProfilerProperty property)
		{
			int[] instanceIDs = property.instanceIDs;
			List<UnityEngine.Object> list = new List<UnityEngine.Object>();
			int[] array = instanceIDs;
			for (int i = 0; i < array.Length; i++)
			{
				int instanceID = array[i];
				UnityEngine.Object @object = EditorUtility.InstanceIDToObject(instanceID);
				Component component = @object as Component;
				if (component != null)
				{
					list.Add(component.gameObject);
				}
				else
				{
					if (@object != null)
					{
						list.Add(@object);
					}
				}
			}
			if (list.Count != 0)
			{
				Selection.objects = list.ToArray();
			}
		}
 private void DrawCPUOrRenderingToolbar(ProfilerProperty property)
 {
     EditorGUILayout.BeginHorizontal(EditorStyles.toolbar, new GUILayoutOption[0]);
     string[] displayedOptions = new string[] { "Hierarchy", "Timeline", "Raw Hierarchy" };
     int[] numArray1 = new int[3];
     numArray1[1] = 1;
     numArray1[2] = 2;
     int[] optionValues = numArray1;
     GUILayoutOption[] options = new GUILayoutOption[] { GUILayout.Width(120f) };
     this.m_ViewType = (ProfilerViewType) EditorGUILayout.IntPopup((int) this.m_ViewType, displayedOptions, optionValues, EditorStyles.toolbarDropDown, options);
     GUILayout.FlexibleSpace();
     GUILayout.Label(string.Format("CPU:{0}ms   GPU:{1}ms", property.frameTime, property.frameGpuTime), EditorStyles.miniLabel, new GUILayoutOption[0]);
     GUI.enabled = ProfilerDriver.GetNextFrameIndex(this.m_CurrentFrame) == -1;
     if (GUILayout.Button(!GUI.enabled ? ms_Styles.noFrameDebugger : ms_Styles.frameDebugger, EditorStyles.toolbarButton, new GUILayoutOption[0]))
     {
         FrameDebuggerWindow.ShowFrameDebuggerWindow().EnableIfNeeded();
     }
     GUI.enabled = true;
     if (ProfilerInstrumentationPopup.InstrumentationEnabled && GUILayout.Button(ms_Styles.profilerInstrumentation, EditorStyles.toolbarDropDown, new GUILayoutOption[0]))
     {
         ProfilerInstrumentationPopup.Show(GUILayoutUtility.topLevel.GetLast());
     }
     GUILayout.FlexibleSpace();
     if (this.m_ViewType == ProfilerViewType.Timeline)
     {
         this.m_TimelineViewDetail = GUILayout.Toggle(this.m_TimelineViewDetail, ms_Styles.timelineHighDetail, EditorStyles.toolbarButton, new GUILayoutOption[0]);
         ms_Styles.memRecord.text = "Mem Record";
         if (this.m_SelectedMemRecordMode != ProfilerMemoryRecordMode.None)
         {
             string text = ms_Styles.memRecord.text;
             object[] objArray1 = new object[] { text, " [", this.s_CheckMark, "]" };
             ms_Styles.memRecord.text = string.Concat(objArray1);
         }
         GUILayoutOption[] optionArray2 = new GUILayoutOption[] { GUILayout.Width(100f) };
         Rect position = GUILayoutUtility.GetRect(ms_Styles.memRecord, EditorStyles.toolbarDropDown, optionArray2);
         if (EditorGUI.ButtonMouseDown(position, ms_Styles.memRecord, FocusType.Passive, EditorStyles.toolbarDropDown))
         {
             string[] strArray2 = new string[] { "None", "Sample only", "Callstack (fast)", "Callstack (full)" };
             bool[] enabled = new bool[strArray2.Length];
             for (int i = 0; i < strArray2.Length; i++)
             {
                 enabled[i] = true;
             }
             int[] selected = new int[] { this.m_SelectedMemRecordMode };
             EditorUtility.DisplayCustomMenu(position, strArray2, enabled, selected, new EditorUtility.SelectMenuItemFunction(this.MemRecordModeClick), null);
         }
     }
     else
     {
         this.SearchFieldGUI();
     }
     EditorGUILayout.EndHorizontal();
     this.HandleCommandEvents();
 }
			private void IterateProfilingData(ProfilerProperty property, ProfilerColumn[] columns, string searchString)
			{
				this.m_NumResultsUsed = 0;
				this.m_ColumnsToShow = columns;
				this.m_FoundAllResults = true;
				this.m_SelectedSearchIndex = -1;
				int num = 0;
				string selectedPropertyPath = ProfilerDriver.selectedPropertyPath;
				while (property.Next(true))
				{
					if (num >= this.m_SearchResults.Length)
					{
						this.m_FoundAllResults = false;
						break;
					}
					string propertyPath = property.propertyPath;
					int startIndex = Mathf.Max(propertyPath.LastIndexOf('/'), 0);
					if (propertyPath.IndexOf(searchString, startIndex, StringComparison.CurrentCultureIgnoreCase) > -1)
					{
						string[] array = new string[this.m_ColumnsToShow.Length];
						for (int i = 0; i < this.m_ColumnsToShow.Length; i++)
						{
							array[i] = property.GetColumn(this.m_ColumnsToShow[i]);
						}
						this.m_SearchResults[num].propertyPath = propertyPath;
						this.m_SearchResults[num].columnValues = array;
						if (propertyPath == selectedPropertyPath)
						{
							this.m_SelectedSearchIndex = num;
						}
						num++;
					}
				}
				this.m_NumResultsUsed = num;
			}
 public void OnGUI(Rect clippingRect, ProfilerProperty property, bool showInactiveDSPChains, bool highlightAudibleDSPChains, ref float zoomFactor, ref Vector2 scrollPos)
 {
     if (((Event.current.type == EventType.ScrollWheel) && clippingRect.Contains(Event.current.mousePosition)) && Event.current.shift)
     {
         float num = 1.05f;
         float num2 = zoomFactor;
         zoomFactor *= (Event.current.delta.y <= 0f) ? (1f / num) : num;
         scrollPos = (Vector2) (scrollPos + ((Event.current.mousePosition - scrollPos) * (zoomFactor - num2)));
         Event.current.Use();
     }
     else if (Event.current.type == EventType.Repaint)
     {
         int num3 = 0x40;
         int num4 = 0x10;
         int num5 = 140;
         int num6 = 30;
         int num7 = num3 + 10;
         int num8 = 5;
         Dictionary<int, AudioProfilerDSPNode> dictionary = new Dictionary<int, AudioProfilerDSPNode>();
         List<AudioProfilerDSPWire> list = new List<AudioProfilerDSPWire>();
         AudioProfilerDSPInfo[] audioProfilerDSPInfo = property.GetAudioProfilerDSPInfo();
         if (audioProfilerDSPInfo != null)
         {
             bool flag = true;
             foreach (AudioProfilerDSPInfo info in audioProfilerDSPInfo)
             {
                 if (showInactiveDSPChains || ((info.flags & 1) != 0))
                 {
                     if (!dictionary.ContainsKey(info.id))
                     {
                         AudioProfilerDSPNode firstTarget = !dictionary.ContainsKey(info.target) ? null : dictionary[info.target];
                         if (firstTarget != null)
                         {
                             dictionary[info.id] = new AudioProfilerDSPNode(firstTarget, info, (firstTarget.x + num5) + num7, firstTarget.maxY, firstTarget.level + 1);
                             firstTarget.maxY += num6 + num8;
                             for (AudioProfilerDSPNode node2 = firstTarget; node2 != null; node2 = node2.firstTarget)
                             {
                                 node2.maxY = Mathf.Max(node2.maxY, firstTarget.maxY);
                             }
                         }
                         else if (flag)
                         {
                             flag = false;
                             dictionary[info.id] = new AudioProfilerDSPNode(firstTarget, info, 10 + (num5 / 2), 10 + (num6 / 2), 1);
                         }
                         if (firstTarget != null)
                         {
                             list.Add(new AudioProfilerDSPWire(dictionary[info.id], firstTarget, info));
                         }
                     }
                     else
                     {
                         list.Add(new AudioProfilerDSPWire(dictionary[info.id], dictionary[info.target], info));
                     }
                 }
             }
             foreach (KeyValuePair<int, AudioProfilerDSPNode> pair in dictionary)
             {
                 AudioProfilerDSPNode node3 = pair.Value;
                 node3.y += ((node3.maxY != node3.y) ? (node3.maxY - node3.y) : (num6 + num8)) / 2;
             }
             foreach (AudioProfilerDSPWire wire in list)
             {
                 float num10 = 4f;
                 AudioProfilerDSPNode source = wire.source;
                 AudioProfilerDSPNode target = wire.target;
                 AudioProfilerDSPInfo info2 = wire.info;
                 Vector3 p = new Vector3((source.x - (num5 * 0.5f)) * zoomFactor, source.y * zoomFactor, 0f);
                 Vector3 vector3 = new Vector3((target.x + (num5 * 0.5f)) * zoomFactor, (target.y + (wire.targetPort * num10)) * zoomFactor, 0f);
                 int outCode = GetOutCode(p, clippingRect);
                 int num12 = GetOutCode(vector3, clippingRect);
                 if ((outCode & num12) == 0)
                 {
                     float width = 3f;
                     Handles.color = new Color(info2.weight, 0f, 0f, (highlightAudibleDSPChains && !source.audible) ? 0.4f : 1f);
                     Vector3[] points = new Vector3[] { p, vector3 };
                     Handles.DrawAAPolyLine(width, 2, points);
                 }
             }
             foreach (AudioProfilerDSPWire wire2 in list)
             {
                 AudioProfilerDSPNode node6 = wire2.source;
                 AudioProfilerDSPNode node7 = wire2.target;
                 AudioProfilerDSPInfo info3 = wire2.info;
                 if (info3.weight != 1f)
                 {
                     int num14 = node6.x - ((num7 + num5) / 2);
                     int num15 = (node7 == null) ? node7.y : (node7.y + ((int) ((((num14 - node7.x) - (num5 * 0.5f)) * (node6.y - node7.y)) / ((float) ((node6.x - node7.x) - num5)))));
                     this.DrawRectClipped(new Rect((float) (num14 - (num3 / 2)), (float) (num15 - (num4 / 2)), (float) num3, (float) num4), new Color(1f, 0.3f, 0.2f, (highlightAudibleDSPChains && !node6.audible) ? 0.4f : 1f), string.Format("{0:0.00}%", 100f * info3.weight), clippingRect, zoomFactor);
                 }
             }
             foreach (KeyValuePair<int, AudioProfilerDSPNode> pair2 in dictionary)
             {
                 AudioProfilerDSPNode node8 = pair2.Value;
                 AudioProfilerDSPInfo info4 = node8.info;
                 if (dictionary.ContainsKey(info4.target) && (node8.firstTarget == dictionary[info4.target]))
                 {
                     string audioProfilerNameByOffset = property.GetAudioProfilerNameByOffset(info4.nameOffset);
                     float num16 = 0.01f * info4.cpuLoad;
                     float num17 = 0.1f;
                     bool flag2 = (info4.flags & 1) != 0;
                     bool flag3 = (info4.flags & 2) != 0;
                     Color col = new Color((flag2 && !flag3) ? Mathf.Clamp((float) ((2f * num17) * num16), (float) 0f, (float) 1f) : 0.5f, (flag2 && !flag3) ? Mathf.Clamp((float) (2f - ((2f * num17) * num16)), (float) 0f, (float) 1f) : 0.5f, !flag3 ? (!flag2 ? 0.5f : 0f) : 1f, (highlightAudibleDSPChains && !node8.audible) ? 0.4f : 1f);
                     audioProfilerNameByOffset = audioProfilerNameByOffset.Replace("ChannelGroup", "Group").Replace("FMOD Channel", "Channel").Replace("FMOD WaveTable Unit", "Wavetable").Replace("FMOD Resampler Unit", "Resampler").Replace("FMOD Channel DSPHead Unit", "Channel DSP").Replace("FMOD Channel DSPHead Unit", "Channel DSP") + string.Format(" ({0:0.00}%)", num16);
                     this.DrawRectClipped(new Rect(node8.x - (num5 * 0.5f), node8.y - (num6 * 0.5f), (float) num5, (float) num6), col, audioProfilerNameByOffset, clippingRect, zoomFactor);
                     if (node8.audible)
                     {
                         if (info4.numLevels >= 1)
                         {
                             float height = (num6 - 6) * Mathf.Clamp(info4.level1, 0f, 1f);
                             this.DrawRectClipped(new Rect((node8.x - (num5 * 0.5f)) + 3f, (node8.y - (num6 * 0.5f)) + 3f, 4f, (float) (num6 - 6)), Color.black, null, clippingRect, zoomFactor);
                             this.DrawRectClipped(new Rect((node8.x - (num5 * 0.5f)) + 3f, (((node8.y - (num6 * 0.5f)) - 3f) + num6) - height, 4f, height), Color.red, null, clippingRect, zoomFactor);
                         }
                         if (info4.numLevels >= 2)
                         {
                             float num19 = (num6 - 6) * Mathf.Clamp(info4.level2, 0f, 1f);
                             this.DrawRectClipped(new Rect((node8.x - (num5 * 0.5f)) + 8f, (node8.y - (num6 * 0.5f)) + 3f, 4f, (float) (num6 - 6)), Color.black, null, clippingRect, zoomFactor);
                             this.DrawRectClipped(new Rect((node8.x - (num5 * 0.5f)) + 8f, (((node8.y - (num6 * 0.5f)) - 3f) + num6) - num19, 4f, num19), Color.red, null, clippingRect, zoomFactor);
                         }
                     }
                 }
             }
         }
     }
 }
		public void DoGUI(ProfilerProperty property, string searchString, bool expandAll)
		{
			this.m_ExpandAll = expandAll;
			this.SetupSplitter();
			this.DoScrolling();
			int controlID = GUIUtility.GetControlID(ProfilerHierarchyGUI.hierarchyViewHash, FocusType.Keyboard);
			this.DrawColumnsHeader(searchString);
			this.m_TextScroll = EditorGUILayout.BeginScrollView(this.m_TextScroll, ProfilerHierarchyGUI.ms_Styles.background, new GUILayoutOption[0]);
			int rowCount = this.DrawProfilingData(property, searchString, controlID);
			property.Cleanup();
			this.UnselectIfClickedOnEmptyArea(rowCount);
			if (Event.current.type == EventType.Repaint)
			{
				this.m_ScrollViewHeight = (int)GUIClip.visibleRect.height;
			}
			GUILayout.EndScrollView();
			this.HandleKeyboard(controlID);
			if (this.m_SetKeyboardFocus && Event.current.type == EventType.Repaint)
			{
				this.m_SetKeyboardFocus = false;
				GUIUtility.keyboardControl = controlID;
				this.m_Window.Repaint();
			}
		}
 private static string DetailViewSelectedPropertyPath(ProfilerProperty property)
 {
     if (((property != null) && (property.instanceIDs != null)) && ((property.instanceIDs.Length != 0) && (property.instanceIDs[0] != 0)))
     {
         return DetailViewSelectedPropertyPath(property, property.instanceIDs[0]);
     }
     return string.Empty;
 }
Beispiel #52
0
        private bool DrawProfileDataItem(ProfilerProperty property, int rowCount, bool selected, int id)
        {
            bool     flag               = false;
            Event    current            = Event.current;
            Rect     rowRect            = this.GetRowRect(rowCount);
            Rect     position           = rowRect;
            GUIStyle rowBackgroundStyle = this.GetRowBackgroundStyle(rowCount);

            if (current.type == EventType.Repaint)
            {
                rowBackgroundStyle.Draw(position, GUIContent.none, false, false, selected, false);
            }
            float num = (float)property.depth * 16f + 4f;

            if (property.HasChildren)
            {
                flag        = this.IsExpanded(property.propertyPath);
                GUI.changed = false;
                num        -= 14f;
                Rect position2 = new Rect(num, position.y, 14f, 16f);
                flag = GUI.Toggle(position2, flag, GUIContent.none, ProfilerHierarchyGUI.styles.foldout);
                if (GUI.changed)
                {
                    this.SetExpanded(property, flag);
                }
                num += 16f;
            }
            if (current.type == EventType.Repaint)
            {
                this.DrawTextColumn(ref position, property.GetColumn(this.m_ColumnsToShow[0]), 0, (this.m_ColumnsToShow[0] != ProfilerColumn.FunctionName) ? 4f : num, selected);
                ProfilerHierarchyGUI.styles.numberLabel.alignment = TextAnchor.MiddleRight;
                int num2 = 1;
                for (int i = 1; i < this.m_VisibleColumns.Length; i++)
                {
                    if (this.ColIsVisible(i))
                    {
                        position.x    += (float)this.m_Splitter.realSizes[num2 - 1];
                        position.width = (float)this.m_Splitter.realSizes[num2] - 4f;
                        num2++;
                        ProfilerHierarchyGUI.styles.numberLabel.Draw(position, property.GetColumn(this.m_ColumnsToShow[i]), false, false, false, selected);
                    }
                }
                ProfilerHierarchyGUI.styles.numberLabel.alignment = TextAnchor.MiddleLeft;
            }
            if (current.type == EventType.MouseDown && rowRect.Contains(current.mousePosition))
            {
                GUIUtility.hotControl = 0;
                if (!EditorGUI.actionKey)
                {
                    if (this.m_DetailPane)
                    {
                        if (current.clickCount == 1 && property.instanceIDs.Length > 0)
                        {
                            string text = ProfilerHierarchyGUI.DetailViewSelectedPropertyPath(property);
                            if (this.m_DetailViewSelectedProperty != text)
                            {
                                this.m_DetailViewSelectedProperty = text;
                                UnityEngine.Object @object = EditorUtility.InstanceIDToObject(property.instanceIDs[0]);
                                if (@object is Component)
                                {
                                    @object = ((Component)@object).gameObject;
                                }
                                if (@object != null)
                                {
                                    EditorGUIUtility.PingObject(@object.GetInstanceID());
                                }
                            }
                            else
                            {
                                this.m_DetailViewSelectedProperty = string.Empty;
                            }
                        }
                        else
                        {
                            if (current.clickCount == 2)
                            {
                                ProfilerHierarchyGUI.SelectObjectsInHierarchyView(property);
                                this.m_DetailViewSelectedProperty = ProfilerHierarchyGUI.DetailViewSelectedPropertyPath(property);
                            }
                        }
                    }
                    else
                    {
                        this.RowMouseDown(property.propertyPath);
                    }
                    this.DoScroll();
                }
                else
                {
                    if (!this.m_DetailPane)
                    {
                        this.m_Window.ClearSelectedPropertyPath();
                    }
                    else
                    {
                        this.m_DetailViewSelectedProperty = string.Empty;
                    }
                }
                GUIUtility.keyboardControl = id;
                current.Use();
            }
            if (selected && GUIUtility.keyboardControl == id && current.type == EventType.KeyDown && (current.keyCode == KeyCode.Return || current.keyCode == KeyCode.KeypadEnter))
            {
                ProfilerHierarchyGUI.SelectObjectsInHierarchyView(property);
            }
            return(flag);
        }
Beispiel #53
0
 private static string DetailViewSelectedPropertyPath(ProfilerProperty property, int instanceId)
 {
     return(property.propertyPath + "/" + instanceId);
 }
 private void DrawCPUOrRenderingToolbar(ProfilerProperty property)
 {
   EditorGUILayout.BeginHorizontal(EditorStyles.toolbar, new GUILayoutOption[0]);
   this.m_ViewType = (ProfilerViewType) EditorGUILayout.IntPopup((int) this.m_ViewType, new string[3]
   {
     "Hierarchy",
     "Timeline",
     "Raw Hierarchy"
   }, new int[3]{ 0, 1, 2 }, EditorStyles.toolbarDropDown, new GUILayoutOption[1]
   {
     GUILayout.Width(100f)
   });
   GUILayout.FlexibleSpace();
   GUILayout.Label(string.Format("CPU:{0}ms   GPU:{1}ms", (object) property.frameTime, (object) property.frameGpuTime), EditorStyles.miniLabel, new GUILayoutOption[0]);
   GUI.enabled = ProfilerDriver.GetNextFrameIndex(this.m_CurrentFrame) == -1;
   if (GUILayout.Button(!GUI.enabled ? ProfilerWindow.ms_Styles.noFrameDebugger : ProfilerWindow.ms_Styles.frameDebugger, EditorStyles.toolbarButton, new GUILayoutOption[0]))
     FrameDebuggerWindow.ShowFrameDebuggerWindow().EnableIfNeeded();
   GUI.enabled = true;
   if (ProfilerInstrumentationPopup.InstrumentationEnabled && GUILayout.Button(ProfilerWindow.ms_Styles.profilerInstrumentation, EditorStyles.toolbarDropDown, new GUILayoutOption[0]))
     ProfilerInstrumentationPopup.Show(GUILayoutUtility.topLevel.GetLast());
   GUILayout.FlexibleSpace();
   this.SearchFieldGUI();
   EditorGUILayout.EndHorizontal();
   this.HandleCommandEvents();
 }
		public ProfilerProperty GetDetailedProperty(ProfilerProperty property)
		{
			bool enterChildren = true;
			string selectedPropertyPath = ProfilerDriver.selectedPropertyPath;
			while (property.Next(enterChildren))
			{
				string propertyPath = property.propertyPath;
				if (propertyPath == selectedPropertyPath)
				{
					ProfilerProperty profilerProperty = new ProfilerProperty();
					profilerProperty.InitializeDetailProperty(property);
					return profilerProperty;
				}
				if (property.HasChildren)
				{
					enterChildren = this.IsExpanded(propertyPath);
				}
			}
			return null;
		}
		private void SetExpanded(ProfilerProperty property, bool expanded)
		{
			this.SetExpanded(property.propertyPath, expanded);
		}
 private void UpdateIfNeeded(int frameIndex, ProfilerViewType viewType, string selectedPropertyPath)
 {
     if (!this.m_CachedProfilerPropertyConfig.EqualsTo(frameIndex, viewType, ProfilerColumn.DontSort))
     {
         ProfilerProperty rootProperty         = this.m_MainProfilerHierarchyGUI.GetRootProperty();
         string           profilerPropertyName = ProfilerDetailedCallsView.GetProfilerPropertyName(selectedPropertyPath);
         this.m_TotalSelectedPropertyTime = 0f;
         Dictionary <string, ProfilerDetailedCallsView.CallInformation> dictionary  = new Dictionary <string, ProfilerDetailedCallsView.CallInformation>();
         Dictionary <string, ProfilerDetailedCallsView.CallInformation> dictionary2 = new Dictionary <string, ProfilerDetailedCallsView.CallInformation>();
         Stack <ProfilerDetailedCallsView.ParentCallInfo> stack = new Stack <ProfilerDetailedCallsView.ParentCallInfo>();
         bool flag = false;
         while (rootProperty.Next(true))
         {
             string propertyName = rootProperty.propertyName;
             int    depth        = rootProperty.depth;
             if (stack.Count + 1 != depth)
             {
                 while (stack.Count + 1 > depth)
                 {
                     stack.Pop();
                 }
                 flag = (stack.Count != 0 && profilerPropertyName == stack.Peek().name);
             }
             if (stack.Count != 0)
             {
                 ProfilerDetailedCallsView.ParentCallInfo parentCallInfo = stack.Peek();
                 if (profilerPropertyName == propertyName)
                 {
                     float columnAsSingle = rootProperty.GetColumnAsSingle(ProfilerColumn.TotalTime);
                     int   num            = (int)rootProperty.GetColumnAsSingle(ProfilerColumn.Calls);
                     int   num2           = (int)rootProperty.GetColumnAsSingle(ProfilerColumn.GCMemory);
                     ProfilerDetailedCallsView.CallInformation callInformation;
                     if (!dictionary.TryGetValue(parentCallInfo.name, out callInformation))
                     {
                         dictionary.Add(parentCallInfo.name, new ProfilerDetailedCallsView.CallInformation
                         {
                             name            = parentCallInfo.name,
                             path            = parentCallInfo.path,
                             callsCount      = num,
                             gcAllocBytes    = num2,
                             totalCallTimeMs = (double)parentCallInfo.timeMs,
                             totalSelfTimeMs = (double)columnAsSingle
                         });
                     }
                     else
                     {
                         callInformation.callsCount      += num;
                         callInformation.gcAllocBytes    += num2;
                         callInformation.totalCallTimeMs += (double)parentCallInfo.timeMs;
                         callInformation.totalSelfTimeMs += (double)columnAsSingle;
                     }
                     this.m_TotalSelectedPropertyTime += columnAsSingle;
                 }
                 if (flag)
                 {
                     float columnAsSingle = rootProperty.GetColumnAsSingle(ProfilerColumn.TotalTime);
                     int   num            = (int)rootProperty.GetColumnAsSingle(ProfilerColumn.Calls);
                     int   num2           = (int)rootProperty.GetColumnAsSingle(ProfilerColumn.GCMemory);
                     ProfilerDetailedCallsView.CallInformation callInformation;
                     if (!dictionary2.TryGetValue(propertyName, out callInformation))
                     {
                         dictionary2.Add(propertyName, new ProfilerDetailedCallsView.CallInformation
                         {
                             name            = propertyName,
                             path            = rootProperty.propertyPath,
                             callsCount      = num,
                             gcAllocBytes    = num2,
                             totalCallTimeMs = (double)columnAsSingle,
                             totalSelfTimeMs = 0.0
                         });
                     }
                     else
                     {
                         callInformation.callsCount      += num;
                         callInformation.gcAllocBytes    += num2;
                         callInformation.totalCallTimeMs += (double)columnAsSingle;
                     }
                 }
             }
             else if (profilerPropertyName == propertyName)
             {
                 float columnAsSingle = rootProperty.GetColumnAsSingle(ProfilerColumn.TotalTime);
                 this.m_TotalSelectedPropertyTime += columnAsSingle;
             }
             if (rootProperty.HasChildren)
             {
                 float columnAsSingle = rootProperty.GetColumnAsSingle(ProfilerColumn.TotalTime);
                 stack.Push(new ProfilerDetailedCallsView.ParentCallInfo
                 {
                     name   = propertyName,
                     path   = rootProperty.propertyPath,
                     timeMs = columnAsSingle
                 });
                 flag = (profilerPropertyName == propertyName);
             }
         }
         this.m_CallersTreeView.SetCallsData(new ProfilerDetailedCallsView.CallsData
         {
             calls = dictionary.Values.ToList <ProfilerDetailedCallsView.CallInformation>(),
             totalSelectedPropertyTime = this.m_TotalSelectedPropertyTime
         });
         this.m_CalleesTreeView.SetCallsData(new ProfilerDetailedCallsView.CallsData
         {
             calls = dictionary2.Values.ToList <ProfilerDetailedCallsView.CallInformation>(),
             totalSelectedPropertyTime = this.m_TotalSelectedPropertyTime
         });
         this.m_TotalSelectedPropertyTimeLabel.text = profilerPropertyName + string.Format(" - Total time: {0:f2} ms", this.m_TotalSelectedPropertyTime);
         this.m_CachedProfilerPropertyConfig.Set(frameIndex, viewType, ProfilerColumn.TotalTime);
     }
 }
 private int DrawTreeView(ProfilerProperty property, int id)
 {
   this.m_SelectedIndex = -1;
   bool enterChildren = true;
   int rowCount = 0;
   string selectedPropertyPath = ProfilerDriver.selectedPropertyPath;
   while (property.Next(enterChildren))
   {
     string propertyPath = property.propertyPath;
     bool selected = !this.m_DetailPane ? propertyPath == selectedPropertyPath : this.m_DetailViewSelectedProperty != string.Empty && this.m_DetailViewSelectedProperty == ProfilerHierarchyGUI.DetailViewSelectedPropertyPath(property);
     if (selected)
       this.m_SelectedIndex = rowCount;
     enterChildren = ((Event.current.type != EventType.Layout ? 1 : 0) & (this.m_ScrollViewHeight == 0 ? 1 : ((double) rowCount * 16.0 > (double) this.m_ScrollViewHeight + (double) this.m_TextScroll.y ? 0 : ((double) (rowCount + 1) * 16.0 > (double) this.m_TextScroll.y ? 1 : 0)))) == 0 ? property.HasChildren && this.IsExpanded(propertyPath) : this.DrawProfileDataItem(property, rowCount, selected, id);
     ++rowCount;
   }
   return rowCount;
 }