Exemple #1
0
            public History(TreeMapPane pane)
            {
                Mode = pane.m_UIState.CurrentMode;

                if (pane.m_TreeMap.SelectedItem != null)
                {
                    m_SelectedItem = pane.m_TreeMap.SelectedItem.Metric;
                    m_GroupName    = m_SelectedItem.GetTypeName();
                }
                else if (pane.m_TreeMap.SelectedGroup != null)
                {
                    m_GroupName = pane.m_TreeMap.SelectedGroup.Name;
                }
            }
Exemple #2
0
        public void AddMetric(ObjectMetric metric)
        {
            var groupName = metric.GetTypeName();

            if (!_groups.ContainsKey(groupName))
            {
                Group newGroup = new Group();
                newGroup.Name  = groupName;
                newGroup.Items = new List <Item>();
                _groups.Add(groupName, newGroup);
            }
            Item item = new Item(metric, _groups[groupName]);

            _items.Add(item);
            _groups[groupName].Items.Add(item);
        }
Exemple #3
0
        public bool HasMetric(ObjectMetric metric)
        {
            var i = _items.FindIndex(x => x.Metric.Equals(metric));

            return(i >= 0);
        }
Exemple #4
0
        public void SelectThing(ObjectMetric thing)
        {
            var item = _items.First(i => i.Metric.Equals(thing));

            SelectItem(item);
        }
 public Item(ObjectMetric metric, Group group)
 {
     Metric = metric;
     Group  = group;
     Label  = Metric.GetName() + "\n" + EditorUtility.FormatBytes(Value);
 }
Exemple #6
0
        void OpenMetricData(Treemap.ObjectMetric metric, bool focus)
        {
            switch (metric.MetricType)
            {
            case Treemap.ObjectMetricType.Managed:

                var metricTypeName = metric.GetTypeName();
                if (m_CurrentTableTypeFilter == metricTypeName)
                {
                    var builder = new Database.View.Where.Builder("Index", Database.Operation.Operator.Equal, new Database.Operation.Expression.MetaExpression(metric.GetObjectUID().ToString(), true));

                    var whereStatement = builder.Build(null, null, null, null, null, m_Spreadsheet.DisplayTable, null);     //yeah we could add a no param Build() too..
                    var row            = whereStatement.GetFirstMatchIndex(-1);

                    if (row > 0)
                    {
                        m_Spreadsheet.Goto(new Database.CellPosition(row, 0));
                        return;
                    }
                }

                var lr = new Database.LinkRequestTable();
                lr.LinkToOpen           = new Database.TableLink();
                lr.LinkToOpen.TableName = TableName;
                lr.SourceTable          = null;
                lr.SourceColumn         = null;
                lr.SourceRow            = -1;
                var managedObj = m_UIState.snapshotMode.snapshot.CrawledData.ManagedObjects[metric.ObjectIndex];
                lr.Parameters.AddValue(ObjectTable.ObjParamName, managedObj.PtrObject);
                lr.Parameters.AddValue(ObjectTable.TypeParamName, managedObj.ITypeDescription);
                OpenLinkRequest(lr, focus, metricTypeName);
                break;

            case Treemap.ObjectMetricType.Native:

                metricTypeName = metric.GetTypeName();
                var instanceId = m_UIState.snapshotMode.snapshot.nativeObjects.instanceId[metric.ObjectIndex];

                if (m_CurrentTableTypeFilter == metricTypeName)
                {
                    var builder        = new Database.View.Where.Builder("NativeInstanceId", Database.Operation.Operator.Equal, new Database.Operation.Expression.MetaExpression(instanceId.ToString(), true));
                    var whereStatement = builder.Build(null, null, null, null, null, m_Spreadsheet.DisplayTable, null);     //yeah we could add a no param Build() too..
                    var row            = whereStatement.GetFirstMatchIndex(-1);

                    if (row > 0)
                    {
                        m_Spreadsheet.Goto(new Database.CellPosition(row, 0));
                        return;
                    }
                }
                lr                      = new Database.LinkRequestTable();
                lr.LinkToOpen           = new Database.TableLink();
                lr.LinkToOpen.TableName = TableName;
                var b = new Database.View.Where.Builder("NativeInstanceId", Database.Operation.Operator.Equal, new Database.Operation.Expression.MetaExpression(instanceId.ToString(), true));
                lr.LinkToOpen.RowWhere = new System.Collections.Generic.List <Database.View.Where.Builder>();
                lr.LinkToOpen.RowWhere.Add(b);
                lr.SourceTable  = null;
                lr.SourceColumn = null;
                lr.SourceRow    = -1;
                OpenLinkRequest(lr, focus, metricTypeName);
                break;
            }
        }
Exemple #7
0
        public void ShowAllObjects(Treemap.ObjectMetric itemCopyToSelect, bool focus)
        {
            // TODO: Fix history zooming UX
            focus = false;

            Treemap.ObjectMetric itemToSelect = default(Treemap.ObjectMetric);
            m_TreeMap.ClearMetric();
            if (m_CurrentCodeType == CodeType.Unknown || m_CurrentCodeType == CodeType.Managed)
            {
                var managedObjects = m_UIState.snapshotMode.snapshot.CrawledData.ManagedObjects;
                for (int i = 0; i < managedObjects.Count; ++i)
                {
                    var managedObject = managedObjects[i];
                    if (managedObject.Size > 0)
                    {
                        var o = new Treemap.ObjectMetric(managedObject.ManagedObjectIndex, m_UIState.snapshotMode.snapshot, Treemap.ObjectMetricType.Managed);
                        if (o.Equals(itemCopyToSelect))
                        {
                            itemToSelect = o;
                        }
                        m_TreeMap.AddMetric(o);
                    }
                }
            }
            if (m_CurrentCodeType == CodeType.Unknown || m_CurrentCodeType == CodeType.Native)
            {
                for (int i = 0; i != m_UIState.snapshotMode.snapshot.nativeObjects.Count; ++i)
                {
                    if (m_UIState.snapshotMode.snapshot.nativeObjects.size[i] > 0)
                    {
                        var o = new Treemap.ObjectMetric(i, m_UIState.snapshotMode.snapshot, Treemap.ObjectMetricType.Native);
                        if (o.Equals(itemCopyToSelect))
                        {
                            itemToSelect = o;
                        }
                        m_TreeMap.AddMetric(o);
                    }
                }
            }
            m_TreeMap.UpdateMetric();

            if (!itemToSelect.Equals(default(Treemap.ObjectMetric)))
            {
                OpenMetricData(itemToSelect, focus);
            }
            else
            {
                try
                {
                    var lr = new Database.LinkRequestTable();
                    lr.LinkToOpen           = new Database.TableLink();
                    lr.LinkToOpen.TableName = ObjectAllTable.TableName;
                    lr.SourceTable          = null;
                    lr.SourceColumn         = null;
                    lr.SourceRow            = -1;
                    OpenLinkRequest(lr, false, null, false);
                }
                catch (Exception)
                {
                    throw;
                }
            }
        }