void RefreshCurrentView() { if (_unpackedCrawl == null) { return; } switch (m_selectedView) { case eShowType.InTable: if (_tableBrowser != null) { _tableBrowser.RefreshData(_unpackedCrawl, _preUnpackedCrawl); } break; case eShowType.InTreemap: if (_treeMapView != null) { _treeMapView.Setup(this, _unpackedCrawl); } break; default: break; } }
public void RefreshCurrentView() { if (_unpackedCrawl == null) { return; } switch (m_selectedView) { case eShowType.InTable: if (_tableBrowser != null) { if (_tableBrowser._showdiffToggle && _SnapshotChunks.Count >= 2) { _tableBrowser.RefreshDiffData(_unpackedCrawl, _preUnpackedCrawl); } else { _tableBrowser.RefreshData(_unpackedCrawl); } } break; case eShowType.InTreemap: if (_treeMapView != null) { _treeMapView.Setup(this, _unpackedCrawl); } break; default: break; } }
void Unpack() { _unpackedCrawl = CrawlDataUnpacker.Unpack(_packedCrawled); _inspector = new Inspector(this, _unpackedCrawl, _snapshot); if (_treeMapView != null) { _treeMapView.Setup(this, _unpackedCrawl); } }
void Unpack(Dictionary <int, int> dirtyObjectsy = null) { _unpackedCrawl = CrawlDataUnpacker.Unpack(_packedCrawled); _inspector = new Inspector(this, _unpackedCrawl, _snapshot); if (_treeMapView != null) { _treeMapView.Setup(this, _unpackedCrawl, dirtyObjectsy); } }
private void Unpack() { _previousUnpackedCrawl = _unpackedCrawl; _unpackedCrawl = CrawlDataUnpacker.Unpack(_packedCrawled); _inspector = new Inspector(this, _unpackedCrawl, _snapshot); _filterItems = new FilterItems(this, _unpackedCrawl, _previousUnpackedCrawl); if (_treeMapView != null) { _treeMapView.Setup(this, _unpackedCrawl); } if (_spreadsheetView != null) { _spreadsheetView.Setup(this, _unpackedCrawl); } if (_viewCanvas == null) { _viewCanvas = new ViewCanvas(this); } }
public void RefreshView() { var mode = _modeMgr.GetCurrentMode(); if (mode == null) { return; } _unpackedCrawl = mode.IsDiffing ? _modeMgr.Diff_2nd : _modeMgr.Selected; _inspector = _unpackedCrawl != null ? new Inspector(this, _unpackedCrawl) : null; switch (m_selectedView) { case eShowType.InTable: if (_tableBrowser != null) { if (mode.IsDiffing) { _tableBrowser.ShowDiffedSnapshots(_modeMgr.Diff_1st, _unpackedCrawl); } else { _tableBrowser.ShowSingleSnapshot(_unpackedCrawl); } } break; case eShowType.InTreemap: if (_treeMapView != null) { _treeMapView.Setup(this, _unpackedCrawl); } break; default: break; } Repaint(); }
void OnGUI() { GUILayout.BeginHorizontal(); _enhancedMode = GUILayout.Toggle(_enhancedMode, "Enhanced Mode", GUILayout.MaxWidth(150)); if (GUILayout.Button("Take Snapshot")) { UnityEditor.MemoryProfiler.MemorySnapshot.RequestNewSnapshot(); // the above call (RequestNewSnapshot) is a sync-invoke so we can process it immediately if (_enhancedMode && _autoSaveForComparison) { string filename = MemUtil.Save(_snapshot); if (!string.IsNullOrEmpty(filename)) { Debug.LogFormat("snapshot '{0}' saved.", filename); RefreshSnapshotList(); } } } if (_enhancedMode) { _autoSaveForComparison = GUILayout.Toggle(_autoSaveForComparison, "Auto-Save"); } if (GUILayout.Button("Save Snapshot...")) { if (_snapshot != null) { string fileName = EditorUtility.SaveFilePanel("Save Snapshot", null, "MemorySnapshot", "memsnap"); if (!string.IsNullOrEmpty(fileName)) { System.Runtime.Serialization.Formatters.Binary.BinaryFormatter bf = new System.Runtime.Serialization.Formatters.Binary.BinaryFormatter(); using (Stream stream = File.Open(fileName, FileMode.Create)) { bf.Serialize(stream, _snapshot); } } } else { UnityEngine.Debug.LogWarning("No snapshot to save. Try taking a snapshot first."); } } if (GUILayout.Button("Load Snapshot...")) { string fileName = EditorUtility.OpenFilePanel("Load Snapshot", null, "memsnap"); if (!string.IsNullOrEmpty(fileName)) { System.Runtime.Serialization.Formatters.Binary.BinaryFormatter bf = new System.Runtime.Serialization.Formatters.Binary.BinaryFormatter(); using (Stream stream = File.Open(fileName, FileMode.Open)) { IncomingSnapshot(bf.Deserialize(stream) as PackedMemorySnapshot); } } } if (_enhancedMode) { GUILayout.FlexibleSpace(); { GUILayout.Space(50); EditorGUIUtility.labelWidth = 40; _selectedBegin = EditorGUILayout.Popup(string.Format("Begin"), _selectedBegin, _snapshotFiles, GUILayout.Width(250)); GUILayout.Space(50); _selectedEnd = EditorGUILayout.Popup(string.Format("End"), _selectedEnd, _snapshotFiles, GUILayout.Width(250)); EditorGUIUtility.labelWidth = 0; // reset to default GUILayout.Space(50); } if (_selectedBegin == _selectedEnd) { GUI.enabled = false; } if (GUILayout.Button("Compare", GUILayout.MaxWidth(120))) { Debug.LogFormat("Compare '{0}' with '{1}'", _snapshotFiles[_selectedBegin], _snapshotFiles[_selectedEnd]); var snapshotBegin = MemUtil.Load(_snapshotFiles[_selectedBegin]); var snapshotEnd = MemUtil.Load(_snapshotFiles[_selectedEnd]); if (snapshotBegin != null && snapshotEnd != null) { MemCompareTarget.Instance.SetCompareTarget(snapshotBegin); IncomingSnapshot(snapshotEnd); if (_treeMapView != null) { _treeMapView.Setup(this, _unpackedCrawl, MemCompareTarget.Instance.GetNewlyAdded(_unpackedCrawl)); } } } if (_selectedBegin == _selectedEnd) { GUI.enabled = true; } if (GUILayout.Button("Open Dir", GUILayout.MaxWidth(120))) { EditorUtility.RevealInFinder(MemUtil.SnapshotsDir); } } GUILayout.EndHorizontal(); GUILayout.BeginArea(new Rect(0, MemConst.TopBarHeight, position.width - MemConst.InspectorWidth, 30)); GUILayout.BeginHorizontal(MemStyles.Toolbar); int selected = GUILayout.SelectionGrid((int)m_selectedView, MemConst.ShowTypes, MemConst.ShowTypes.Length, MemStyles.ToolbarButton); if (m_selectedView != (eShowType)selected) { m_selectedView = (eShowType)selected; RefreshCurrentView(); } GUILayout.EndHorizontal(); GUILayout.EndArea(); float TabHeight = 30; float yoffset = MemConst.TopBarHeight + TabHeight; Rect view = new Rect(0f, yoffset, position.width - MemConst.InspectorWidth, position.height - yoffset); switch (m_selectedView) { case eShowType.InTable: if (_tableBrowser != null) { _tableBrowser.Draw(view); } break; case eShowType.InTreemap: if (_treeMapView != null) { _treeMapView.Draw(view); } break; default: break; } if (_inspector != null) { _inspector.Draw(); } //RenderDebugList(); }