Example #1
0
        protected override TreeViewItem BuildRoot()
        {
            int idForhiddenRoot    = -1;
            int depthForHiddenRoot = -1;
            int index = 0;
            FileSummaryTreeViewItem root       = new FileSummaryTreeViewItem(idForhiddenRoot, depthForHiddenRoot, "root", null);
            FileIOFrameSetup        frameSetup = m_ProfilerView.GetFrameSetup();
            int currentFrame = m_ProfilerView.GetSelectedFrame();

            foreach (var fileSummary in m_CaptureData.m_FileSummaryData.Values)
            {
                var filename = Path.GetFileName(fileSummary.filename);

                if (!m_ProfilerView.FilterContains(filename))
                {
                    continue;
                }

                if (frameSetup == FileIOFrameSetup.ThisFrame)
                {
                    if (!fileSummary.frameIndices.Contains(currentFrame))
                    {
                        continue;
                    }
                }

                var item = new FileSummaryTreeViewItem(index, 0, fileSummary.filename, fileSummary);
                root.AddChild(item);
                index++;
            }

            // Return root of the tree
            return(root);
        }
Example #2
0
        void CellGUI(Rect cellRect, FileSummaryTreeViewItem item, SummaryColumns column, ref RowGUIArgs args)
        {
            // Center cell rect vertically (makes it easier to place controls, icons etc in the cells)
            CenterRectUsingSingleLineHeight(ref cellRect);
            switch (column)
            {
            case SummaryColumns.Id:
                CellLabel(cellRect, item, new GUIContent(string.Format("{0}", item.id + 1)));
                break;

            case SummaryColumns.Filename:
                CellLabel(cellRect, item, new GUIContent(item.fileSummary.readableFileName, item.fileSummary.readablePath));
                break;

            case SummaryColumns.TotalAccessCount:
                CellLabel(cellRect, item, new GUIContent(string.Format("{0}", item.fileSummary.accesses)));
                break;

            case SummaryColumns.ReadCount:
                CellLabel(cellRect, item, new GUIContent(string.Format("{0}", item.fileSummary.reads)));
                break;

            case SummaryColumns.WriteCount:
                CellLabel(cellRect, item, new GUIContent(string.Format("{0}", item.fileSummary.writes)));
                break;

            case SummaryColumns.SeekCount:
                CellLabel(cellRect, item, new GUIContent(string.Format("{0}", item.fileSummary.seeks)));
                break;

            case SummaryColumns.OpenCount:
                CellLabel(cellRect, item, new GUIContent(string.Format("{0}", item.fileSummary.opened)));
                break;

            case SummaryColumns.CloseCount:
                CellLabel(cellRect, item, new GUIContent(string.Format("{0}", item.fileSummary.closed)));
                break;

            case SummaryColumns.TotalBytesRead:
                CellLabel(cellRect, item, new GUIContent(string.Format("{0}", EditorUtility.FormatBytes((int)item.fileSummary.bytesRead)), string.Format("{0} B", item.fileSummary.bytesRead)));
                break;

            case SummaryColumns.TotalBytesWritten:
                CellLabel(cellRect, item, new GUIContent(string.Format("{0}", EditorUtility.FormatBytes((int)item.fileSummary.bytesWritten)), string.Format("{0} B", item.fileSummary.bytesWritten)));
                break;

            case SummaryColumns.TotalAccessTimeMs:
                CellLabel(cellRect, item, new GUIContent(string.Format("{0:f2}", item.fileSummary.totalAccessMs)));
                break;

            case SummaryColumns.ReadBandwidthMBps:
                CellLabel(cellRect, item, new GUIContent(string.Format("{0:f2}", item.fileSummary.readBandwidthMegaBytesPerSecond)));
                break;

            case SummaryColumns.WriteBandwidthMBps:
                CellLabel(cellRect, item, new GUIContent(string.Format("{0:f2}", item.fileSummary.writeBandwidthMegaBytesPerSecond)));
                break;

            case SummaryColumns.OpenAccessMs:
                CellLabel(cellRect, item, new GUIContent(string.Format("{0:f2}", item.fileSummary.openAccessMs)));
                break;

            case SummaryColumns.CloseAccessMs:
                CellLabel(cellRect, item, new GUIContent(string.Format("{0:f2}", item.fileSummary.closeAccessMs)));
                break;

            case SummaryColumns.ReadAccessMs:
                CellLabel(cellRect, item, new GUIContent(string.Format("{0:f2}", item.fileSummary.readAccessMs)));
                break;

            case SummaryColumns.WriteAccessMs:
                CellLabel(cellRect, item, new GUIContent(string.Format("{0:f2}", item.fileSummary.writeAccessMs)));
                break;

            case SummaryColumns.FirstFrame:
                CellLabel(cellRect, item, new GUIContent(string.Format("{0}", item.fileSummary.firstFrame + 1)));     // shift to match the indexing in the Profiler view
                break;

            case SummaryColumns.NumberOfFrames:
                CellLabel(cellRect, item, new GUIContent(string.Format("{0}", item.fileSummary.frameIndices.Count)));
                break;
            }
        }
Example #3
0
 private void CellLabel(Rect cellRect, FileSummaryTreeViewItem item, GUIContent content)
 {
     EditorGUI.LabelField(cellRect, content);
 }