コード例 #1
0
        void UpdateIfNeeded(HierarchyFrameDataView frameDataView, int selectedId)
        {
            var needReload = m_SelectedID != selectedId || !Equals(m_FrameDataView, frameDataView);

            if (!needReload)
            {
                return;
            }

            m_FrameDataView = frameDataView;
            m_SelectedID    = selectedId;
            m_TreeView.SetSelection(new List <int>());

            var samplesCount = m_FrameDataView.GetItemMergedSamplesCount(selectedId);
            var columnsCount = m_MultiColumnHeader.columns.Length;

            var objectsData  = new List <ObjectInformation>();
            var objectsDatas = new List <string> [columnsCount];

            // Collect all the data
            var instanceIDs = new List <int>(samplesCount);

            m_FrameDataView.GetItemMergedSamplesInstanceID(selectedId, instanceIDs);
            for (var i = 0; i < columnsCount; i++)
            {
                objectsDatas[i] = new List <string>(samplesCount);
                m_FrameDataView.GetItemMergedSamplesColumnData(selectedId, m_MultiColumnHeader.columns[i].profilerColumn, objectsDatas[i]);
            }

            // Store it per sample
            for (var i = 0; i < samplesCount; i++)
            {
                var objData = new ObjectInformation()
                {
                    columnStrings = new string[columnsCount]
                };
                objData.id          = selectedId;
                objData.sampleIndex = i;

                objData.instanceId = (i < instanceIDs.Count) ? instanceIDs[i] : 0;
                for (var j = 0; j < columnsCount; j++)
                {
                    objData.columnStrings[j] = (i < objectsDatas[j].Count) ? objectsDatas[j][i] : string.Empty;
                }

                objectsData.Add(objData);
            }

            m_TreeView.SetData(objectsData);
        }
コード例 #2
0
        public IList <int> GetSelectedInstanceIds()
        {
            if (m_FrameDataView == null || !m_FrameDataView.valid)
            {
                return(null);
            }
            var selection = GetSelection();

            if (selection == null || selection.Count == 0)
            {
                return(null);
            }

            var allInstanceIds = new List <int>();
            var instanceIds    = new List <int>();

            foreach (var selectedId in selection)
            {
                m_FrameDataView.GetItemMergedSamplesInstanceID(selectedId, instanceIds);
                allInstanceIds.AddRange(instanceIds);
            }
            return(allInstanceIds);
        }
コード例 #3
0
        void UpdateIfNeeded(HierarchyFrameDataView frameDataView, int selectedId)
        {
            var needReload = m_SelectedID != selectedId || !Equals(m_FrameDataView, frameDataView);

            if (!needReload)
            {
                return;
            }

            m_FrameDataView = frameDataView;
            m_SelectedID    = selectedId;
            m_TreeView.SetSelection(new List <int>());

            var samplesCount = m_FrameDataView.GetItemMergedSamplesCount(selectedId);

            // Collect all the data
            var instanceIDs = new List <int>(samplesCount);

            m_FrameDataView.GetItemMergedSamplesInstanceID(selectedId, instanceIDs);

            var columns           = m_MultiColumnHeader.columns;
            var columnsCount      = columns.Length;
            var objectsDatas      = new List <string> [columnsCount];
            var objectsValueDatas = new List <float> [columnsCount];

            for (var i = 0; i < columnsCount; i++)
            {
                objectsDatas[i] = new List <string>(samplesCount);
                m_FrameDataView.GetItemMergedSamplesColumnData(selectedId, columns[i].profilerColumn, objectsDatas[i]);

                objectsValueDatas[i] = new List <float>(samplesCount);
                m_FrameDataView.GetItemMergedSamplesColumnDataAsFloats(selectedId, columns[i].profilerColumn, objectsValueDatas[i]);
            }

            // Store it per sample
            var objectsData = new List <ObjectInformation>();

            for (var i = 0; i < samplesCount; i++)
            {
                var objData = new ObjectInformation()
                {
                    columnStrings = new string[columnsCount], columnValues = new float[columnsCount]
                };
                objData.id          = selectedId;
                objData.sampleIndex = i;

                objData.instanceId = (i < instanceIDs.Count) ? instanceIDs[i] : 0;
                for (var j = 0; j < columnsCount; j++)
                {
                    objData.columnStrings[j] = (i < objectsDatas[j].Count) ? objectsDatas[j][i] : string.Empty;
                    objData.columnValues[j]  = (i < objectsValueDatas[j].Count) ? objectsValueDatas[j][i] : 0.0f;
                }

                objectsData.Add(objData);
            }

            m_TreeView.SetData(objectsData);

            // Update instances label
            var sampleName = m_FrameDataView.GetItemName(selectedId);

            m_InstancesLabel.text    = UnityString.Format(kInstancesCountFormatText, samplesCount, sampleName);
            m_InstancesLabel.tooltip = kInstancesCountTooltipText;
        }