Пример #1
0
        public static void Show(Rect r, string funcName)
        {
            ProfilerInstrumentationPopup instrumentationPopup = new ProfilerInstrumentationPopup((Dictionary <string, int>)null, true, false);

            ProfilerInstrumentationPopup.s_PendingPopup = instrumentationPopup;
            ProfilerDriver.QueryFunctionCallees(funcName);
            PopupWindow.Show(r, (PopupWindowContent)instrumentationPopup);
        }
        public static void Show(Rect r, string funcName)
        {
            ProfilerInstrumentationPopup windowContent = new ProfilerInstrumentationPopup(null, true, false);

            s_PendingPopup = windowContent;
            ProfilerDriver.QueryFunctionCallees(funcName);
            PopupWindow.Show(r, windowContent);
        }
Пример #3
0
        public static void Show(Rect r, string funcName)
        {
            var popup = new ProfilerInstrumentationPopup(null, true, false);

            s_PendingPopup = popup;
            ProfilerDriver.QueryFunctionCallees(funcName);

            PopupWindow.Show(r, popup);
        }
        public static void Show(Rect r)
        {
            ProfilerInstrumentationPopup windowContent = new ProfilerInstrumentationPopup(s_InstrumentableFunctions, false, true);

            if (s_InstrumentableFunctions == null)
            {
                s_PendingPopup = windowContent;
                ProfilerDriver.QueryInstrumentableFunctions();
            }
            else
            {
                s_PendingPopup = null;
            }
            PopupWindow.Show(r, windowContent);
        }
Пример #5
0
        public static void Show(Rect r)
        {
            ProfilerInstrumentationPopup instrumentationPopup = new ProfilerInstrumentationPopup(ProfilerInstrumentationPopup.s_InstrumentableFunctions, false, true);

            if (ProfilerInstrumentationPopup.s_InstrumentableFunctions == null)
            {
                ProfilerInstrumentationPopup.s_PendingPopup = instrumentationPopup;
                ProfilerDriver.QueryInstrumentableFunctions();
            }
            else
            {
                ProfilerInstrumentationPopup.s_PendingPopup = (ProfilerInstrumentationPopup)null;
            }
            PopupWindow.Show(r, (PopupWindowContent)instrumentationPopup);
        }
        private static void SetFunctionNamesFromUnity(bool allFunction, string[] functionNames, int[] isInstrumentedFlags)
        {
            Dictionary <string, int> functions = new Dictionary <string, int>(functionNames.Length);

            for (int i = 0; i < functionNames.Length; i++)
            {
                functions.Add(functionNames[i], isInstrumentedFlags[i]);
            }
            if (allFunction)
            {
                s_InstrumentableFunctions = functions;
            }
            if (s_PendingPopup != null)
            {
                s_PendingPopup.SetFunctions(functions);
                s_PendingPopup = null;
            }
        }
        private static void SetFunctionNamesFromUnity(bool allFunction, string[] functionNames, int[] isInstrumentedFlags)
        {
            Dictionary <string, int> dictionary = new Dictionary <string, int>(functionNames.Length);

            for (int i = 0; i < functionNames.Length; i++)
            {
                dictionary.Add(functionNames[i], isInstrumentedFlags[i]);
            }
            if (allFunction)
            {
                ProfilerInstrumentationPopup.s_InstrumentableFunctions = dictionary;
            }
            if (ProfilerInstrumentationPopup.s_PendingPopup != null)
            {
                ProfilerInstrumentationPopup.s_PendingPopup.SetFunctions(dictionary);
                ProfilerInstrumentationPopup.s_PendingPopup = null;
            }
        }
Пример #8
0
        private static void SetFunctionNamesFromUnity(bool allFunction, string[] functionNames, int[] isInstrumentedFlags)
        {
            Dictionary <string, int> functions = new Dictionary <string, int>(functionNames.Length);

            for (int index = 0; index < functionNames.Length; ++index)
            {
                functions.Add(functionNames[index], isInstrumentedFlags[index]);
            }
            if (allFunction)
            {
                ProfilerInstrumentationPopup.s_InstrumentableFunctions = functions;
            }
            if (ProfilerInstrumentationPopup.s_PendingPopup == null)
            {
                return;
            }
            ProfilerInstrumentationPopup.s_PendingPopup.SetFunctions(functions);
            ProfilerInstrumentationPopup.s_PendingPopup = (ProfilerInstrumentationPopup)null;
        }
Пример #9
0
        // Called from native code in InstrumentationProfiler
        static void SetFunctionNamesFromUnity(bool allFunction, string[] functionNames, int[] isInstrumentedFlags)
        {
            var dict = new Dictionary <string, int>(functionNames.Length);

            for (var i = 0; i < functionNames.Length; ++i)
            {
                dict.Add(functionNames[i], isInstrumentedFlags[i]);
            }

            if (allFunction)
            {
                // No parent name: We received full functions list and should update it
                s_InstrumentableFunctions = dict;
            }

            if (s_PendingPopup != null)
            {
                s_PendingPopup.SetFunctions(dict);
                s_PendingPopup = null;
            }
        }
Пример #10
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;
            }
            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 : num, selected);
            }
            if (ProfilerInstrumentationPopup.InstrumentationEnabled && ProfilerInstrumentationPopup.FunctionHasInstrumentationPopup(column))
            {
                float num2 = position.x + num + 5f + ProfilerHierarchyGUI.styles.numberLabel.CalcSize(new GUIContent(column)).x;
                num2 = Mathf.Clamp(num2, 0f, (float)this.m_Splitter.realSizes[0] - 30f + 2f);
                Rect rect = new Rect(num2, position.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 num3 = 1;
                for (int i = 1; i < this.m_VisibleColumns.Length; i++)
                {
                    if (this.ColIsVisible(i))
                    {
                        position.x    += (float)this.m_Splitter.realSizes[num3 - 1];
                        position.width = (float)this.m_Splitter.realSizes[num3] - 4f;
                        num3++;
                        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);
        }
        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 static void Show(Rect r, string funcName)
 {
   ProfilerInstrumentationPopup instrumentationPopup = new ProfilerInstrumentationPopup((Dictionary<string, int>) null, true, false);
   ProfilerInstrumentationPopup.s_PendingPopup = instrumentationPopup;
   ProfilerDriver.QueryFunctionCallees(funcName);
   PopupWindow.Show(r, (PopupWindowContent) instrumentationPopup);
 }
 public static void Show(Rect r)
 {
   ProfilerInstrumentationPopup instrumentationPopup = new ProfilerInstrumentationPopup(ProfilerInstrumentationPopup.s_InstrumentableFunctions, false, true);
   if (ProfilerInstrumentationPopup.s_InstrumentableFunctions == null)
   {
     ProfilerInstrumentationPopup.s_PendingPopup = instrumentationPopup;
     ProfilerDriver.QueryInstrumentableFunctions();
   }
   else
     ProfilerInstrumentationPopup.s_PendingPopup = (ProfilerInstrumentationPopup) null;
   PopupWindow.Show(r, (PopupWindowContent) instrumentationPopup);
 }
 private static void SetFunctionNamesFromUnity(bool allFunction, string[] functionNames, int[] isInstrumentedFlags)
 {
   Dictionary<string, int> functions = new Dictionary<string, int>(functionNames.Length);
   for (int index = 0; index < functionNames.Length; ++index)
     functions.Add(functionNames[index], isInstrumentedFlags[index]);
   if (allFunction)
     ProfilerInstrumentationPopup.s_InstrumentableFunctions = functions;
   if (ProfilerInstrumentationPopup.s_PendingPopup == null)
     return;
   ProfilerInstrumentationPopup.s_PendingPopup.SetFunctions(functions);
   ProfilerInstrumentationPopup.s_PendingPopup = (ProfilerInstrumentationPopup) null;
 }