void DrawHorizontalDetails() { using (var f = ProfilerDriver.GetRawFrameDataView(ProfilerWindow.GetActiveVisibleFrameIndex(), 0)) { if (f.valid) { EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("Total Overlaps: " + GetCounterValue(f, "Overlaps"), GUILayout.Width(k_labelWidthTitle)); EditorGUILayout.LabelField("| Discreet: " + GetCounterValue(f, "Discreet Overlaps"), GUILayout.Width(k_labelWidthDetail)); EditorGUILayout.LabelField("Continuous: " + GetCounterValue(f, "Continuous Overlaps"), GUILayout.Width(k_labelWidthDetail)); EditorGUILayout.LabelField("Trigger: " + GetCounterValue(f, "Trigger Overlaps"), GUILayout.Width(k_labelWidthDetail)); EditorGUILayout.LabelField("Modified: " + GetCounterValue(f, "Modified Overlaps"), GUILayout.Width(k_labelWidthDetail)); EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("Broadphase Adds/Removes: " + GetCounterValue(f, "Broadphase Adds/Removes"), GUILayout.Width(k_labelWidthTitle)); EditorGUILayout.LabelField("| Adds: " + GetCounterValue(f, "Broadphase Adds"), GUILayout.Width(k_labelWidthDetail)); EditorGUILayout.LabelField("Removes: " + GetCounterValue(f, "Broadphase Removes"), GUILayout.Width(k_labelWidthDetail)); EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("Narrowphase Touches: " + GetCounterValue(f, "Narrowphase Touches"), GUILayout.Width(k_labelWidthTitle)); EditorGUILayout.LabelField("| New: " + GetCounterValue(f, "Narrowphase New Touches"), GUILayout.Width(k_labelWidthDetail)); EditorGUILayout.LabelField("Lost: " + GetCounterValue(f, "Narrowphase Lost Touches"), GUILayout.Width(k_labelWidthDetail)); EditorGUILayout.EndHorizontal(); } } }
Rect DrawAudioStatsPane(ref Vector2 scrollPos) { var totalRect = GUILayoutUtility.GetRect(20f, 20000f, 10, 10000f); var statsRect = new Rect(totalRect.x, totalRect.y, 230f, totalRect.height); var rightRect = new Rect(statsRect.xMax, totalRect.y, totalRect.width - statsRect.width, totalRect.height); // STATS var content = ProfilerDriver.GetOverviewText(area, ProfilerWindow.GetActiveVisibleFrameIndex()); var textSize = EditorStyles.wordWrappedLabel.CalcSize(GUIContent.Temp(content)); scrollPos = GUI.BeginScrollView(statsRect, scrollPos, new Rect(0, 0, textSize.x, textSize.y)); GUI.Label(new Rect(3, 3, textSize.x, textSize.y), content, EditorStyles.wordWrappedLabel); GUI.EndScrollView(); EditorGUI.DrawRect(new Rect(statsRect.xMax - 1, statsRect.y, 1, statsRect.height), Color.black); return(rightRect); }
public override void DrawDetailsView(Rect position) { string activeText = string.Empty; using (var f = ProfilerDriver.GetRawFrameDataView(ProfilerWindow.GetActiveVisibleFrameIndex(), 0)) { if (f.valid) { if (m_ShowStatsView == PhysicsProfilerStatsView.Current) { var stringBuilder = new StringBuilder(1024); stringBuilder.Append("Physics Used Memory: " + GetCounterValueAsBytes(f, "Physics Used Memory")); stringBuilder.Append("\n\nDynamic Bodies: " + GetCounterValue(f, "Dynamic Bodies")); stringBuilder.Append("\nArticulation Bodies: " + GetCounterValue(f, "Articulation Bodies")); stringBuilder.Append("\n\nActive Dynamic Bodies: " + GetCounterValue(f, "Active Dynamic Bodies")); stringBuilder.Append("\nActive Kinematic Bodies: " + GetCounterValue(f, "Active Kinematic Bodies")); stringBuilder.Append("\n\nStatic Colliders: " + GetCounterValue(f, "Static Colliders")); stringBuilder.Append($"\nColliders Synced: {GetCounterValue(f, "Colliders Synced")}"); stringBuilder.Append($"\nRigidbodies Synced: {GetCounterValue(f, "Rigidbodies Synced")}"); stringBuilder.Append("\n\nPhysics Queries: " + GetCounterValue(f, "Physics Queries")); activeText = stringBuilder.ToString(); } else { // Old data compatibility. activeText = ProfilerDriver.GetOverviewText(ProfilerArea.Physics, ProfilerWindow.GetActiveVisibleFrameIndex()); } } } float height = EditorStyles.wordWrappedLabel.CalcHeight(GUIContent.Temp(activeText), position.width); m_PaneScroll = GUILayout.BeginScrollView(m_PaneScroll, ProfilerWindow.Styles.background); EditorGUILayout.SelectableLabel(activeText, EditorStyles.wordWrappedLabel, GUILayout.MinHeight(height)); if (m_ShowStatsView == PhysicsProfilerStatsView.Current && activeText != string.Empty) { DrawHorizontalDetails(); } GUILayout.EndScrollView(); }
private void OnLoadProfileData() { using (var frameData = ProfilerDriver.GetRawFrameDataView(ProfilerWindow.GetActiveVisibleFrameIndex(), 0)) { if (frameData.valid) { var physicsQueries = GetCounterValue(frameData, "Total Queries"); if (physicsQueries != -1) { m_ShowStatsView = PhysicsProfilerStatsView.Current; } else { m_ShowStatsView = PhysicsProfilerStatsView.Legacy; } } } }
public override void DrawDetailsView(Rect position) { string activeText = string.Empty; using (var f = ProfilerDriver.GetRawFrameDataView(ProfilerWindow.GetActiveVisibleFrameIndex(), 0)) { if (f.valid) { var batchesCount = GetCounterValue(f, "Batches Count"); if (batchesCount != -1) { var stringBuilder = new StringBuilder(1024); stringBuilder.Append($"SetPass Calls: {GetCounterValueAsNumber(f, "SetPass Calls Count")} \tDraw Calls: {GetCounterValueAsNumber(f, "Draw Calls Count")} \t\tBatches: {batchesCount} \tTriangles: {GetCounterValueAsNumber(f, "Triangles Count")} \tVertices: {GetCounterValueAsNumber(f, "Vertices Count")}"); stringBuilder.Append($"\n(Dynamic Batching)\tBatched Draw Calls: {GetCounterValueAsNumber(f, "Dynamic Batched Draw Calls Count")} \tBatches: {GetCounterValueAsNumber(f, "Dynamic Batches Count")} \tTriangles: {GetCounterValueAsNumber(f, "Dynamic Batched Triangles Count")} \tVertices: {GetCounterValueAsNumber(f, "Dynamic Batched Vertices Count")} \tTime: {GetCounterValue(f, "Dynamic Batching Time") * 1e-6:0.00}ms"); stringBuilder.Append($"\n(Static Batching)\t\tBatched Draw Calls: {GetCounterValueAsNumber(f, "Static Batched Draw Calls Count")} \tBatches: {GetCounterValueAsNumber(f, "Static Batches Count")} \tTriangles: {GetCounterValueAsNumber(f, "Static Batched Triangles Count")} \tVertices: {GetCounterValueAsNumber(f, "Static Batched Vertices Count")}"); stringBuilder.Append($"\n(Instancing)\t\tBatched Draw Calls: {GetCounterValueAsNumber(f, "Instanced Batched Draw Calls Count")} \tBatches: {GetCounterValueAsNumber(f, "Instanced Batches Count")} \tTriangles: {GetCounterValueAsNumber(f, "Instanced Batched Triangles Count")} \tVertices: {GetCounterValueAsNumber(f, "Instanced Batched Vertices Count")}"); stringBuilder.Append($"\nUsed Textures: {GetCounterValue(f, "Used Textures Count")} / {GetCounterValueAsBytes(f, "Used Textures Bytes")}"); stringBuilder.Append($"\nRender Textures: {GetCounterValue(f, "Render Textures Count")} / {GetCounterValueAsBytes(f, "Render Textures Bytes")}"); stringBuilder.Append($"\nRender Textures Changes: {GetCounterValue(f, "Render Textures Changes Count")}"); stringBuilder.Append($"\nUsed Buffers: {GetCounterValue(f, "Used Buffers Count")} / {GetCounterValueAsBytes(f, "Used Buffers Bytes")}"); stringBuilder.Append($"\nVertex Buffer Upload In Frame: {GetCounterValue(f, "Vertex Buffer Upload In Frame Count")} / {GetCounterValueAsBytes(f, "Vertex Buffer Upload In Frame Bytes")}"); stringBuilder.Append($"\nIndex Buffer Upload In Frame: {GetCounterValue(f, "Index Buffer Upload In Frame Count")} / {GetCounterValueAsBytes(f, "Index Buffer Upload In Frame Bytes")}"); stringBuilder.Append($"\nShadow Casters: {GetCounterValue(f, "Shadow Casters Count")}\n"); activeText = stringBuilder.ToString(); } else { // Old data compatibility. activeText = ProfilerDriver.GetOverviewText(ProfilerArea.Rendering, ProfilerWindow.GetActiveVisibleFrameIndex()); } } } float height = EditorStyles.wordWrappedLabel.CalcHeight(GUIContent.Temp(activeText), position.width); m_PaneScroll = GUILayout.BeginScrollView(m_PaneScroll, ProfilerWindow.Styles.background); EditorGUILayout.SelectableLabel(activeText, EditorStyles.wordWrappedLabel, GUILayout.MinHeight(height)); GUILayout.EndScrollView(); }
public override void DrawDetailsView(Rect position) { if (NetworkingMessagesProfilerOverrides.drawDetailsViewOverride != null) { NetworkingMessagesProfilerOverrides.drawDetailsViewOverride.Invoke(position, ProfilerWindow.GetActiveVisibleFrameIndex()); } else { DrawDetailsViewText(position); } }
public override void DrawDetailsView(Rect position) { m_PaneScroll = GUILayout.BeginScrollView(m_PaneScroll, ProfilerWindow.Styles.background); using (var frameData = ProfilerDriver.GetRawFrameDataView(ProfilerWindow.GetActiveVisibleFrameIndex(), 0)) { if (frameData.valid) { // Initialize the profiler markers. InitializeMarkers(frameData); bool newCountersAvailable = GetPhysicsCounterValue(frameData, "Total Queries") != -1; if (m_ShowStatsView == PhysicsProfilerStatsView.Current) { // Determine if the new counters are available by looking for a counter only available there. if (newCountersAvailable) { // Draw an alternate lined background to make following metrics on the same line easier. DrawAlternateBackground(position, m_PaneScroll, 10); long physicsMemoryUsed = GetCounterValue(frameData, "Physics Used Memory (2D)"); long totalUsedMemory = GetCounterValue(frameData, "Total Used Memory"); EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("Physics Used Memory", GUILayout.Width(k_labelWidthTitle)); EditorGUILayout.LabelField("| Total: " + GetCounterValueAsBytes(frameData, "Physics Used Memory (2D)"), GUILayout.Width(k_labelWidthDetail)); EditorGUILayout.LabelField(string.Format("| Relative: {0:p2}", (float)physicsMemoryUsed / (float)totalUsedMemory), GUILayout.Width(k_labelWidthDetail)); EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("Bodies", GUILayout.Width(k_labelWidthTitle)); EditorGUILayout.LabelField("| Total: " + GetPhysicsCounterValue(frameData, "Total Bodies"), GUILayout.Width(k_labelWidthDetail)); EditorGUILayout.LabelField("| Awake: " + GetPhysicsCounterValue(frameData, "Awake Bodies"), GUILayout.Width(k_labelWidthDetail)); EditorGUILayout.LabelField("| Asleep: " + GetPhysicsCounterValue(frameData, "Asleep Bodies"), GUILayout.Width(k_labelWidthDetail)); EditorGUILayout.LabelField("| Dynamic: " + GetPhysicsCounterValue(frameData, "Dynamic Bodies"), GUILayout.Width(k_labelWidthDetail)); EditorGUILayout.LabelField("| Kinematic: " + GetPhysicsCounterValue(frameData, "Kinematic Bodies"), GUILayout.Width(k_labelWidthDetail)); EditorGUILayout.LabelField("| Static: " + GetPhysicsCounterValue(frameData, "Static Bodies"), GUILayout.Width(k_labelWidthDetail)); EditorGUILayout.LabelField("| Discrete: " + GetPhysicsCounterValue(frameData, "Discrete Bodies"), GUILayout.Width(k_labelWidthDetail)); EditorGUILayout.LabelField("| Continuous: " + GetPhysicsCounterValue(frameData, "Continuous Bodies"), GUILayout.Width(k_labelWidthDetail)); EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("Shapes", GUILayout.Width(k_labelWidthTitle)); EditorGUILayout.LabelField("| Total: " + GetPhysicsCounterValue(frameData, "Total Shapes"), GUILayout.Width(k_labelWidthDetail)); EditorGUILayout.LabelField("| Awake: " + GetPhysicsCounterValue(frameData, "Awake Shapes"), GUILayout.Width(k_labelWidthDetail)); EditorGUILayout.LabelField("| Asleep: " + GetPhysicsCounterValue(frameData, "Asleep Shapes"), GUILayout.Width(k_labelWidthDetail)); EditorGUILayout.LabelField("| Dynamic: " + GetPhysicsCounterValue(frameData, "Dynamic Shapes"), GUILayout.Width(k_labelWidthDetail)); EditorGUILayout.LabelField("| Kinematic: " + GetPhysicsCounterValue(frameData, "Kinematic Shapes"), GUILayout.Width(k_labelWidthDetail)); EditorGUILayout.LabelField("| Static: " + GetPhysicsCounterValue(frameData, "Static Shapes"), GUILayout.Width(k_labelWidthDetail)); EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("Queries", GUILayout.Width(k_labelWidthTitle)); EditorGUILayout.LabelField("| Total: " + GetPhysicsCounterValue(frameData, "Total Queries"), GUILayout.Width(k_labelWidthDetail)); EditorGUILayout.LabelField("| Raycast: " + GetPhysicsCounterValue(frameData, "Raycast Queries"), GUILayout.Width(k_labelWidthDetail)); EditorGUILayout.LabelField("| Shapecast: " + GetPhysicsCounterValue(frameData, "Shapecast Queries"), GUILayout.Width(k_labelWidthDetail)); EditorGUILayout.LabelField("| Overlap: " + GetPhysicsCounterValue(frameData, "Overlap Queries"), GUILayout.Width(k_labelWidthDetail)); EditorGUILayout.LabelField("| IsTouching: " + GetPhysicsCounterValue(frameData, "IsTouching Queries"), GUILayout.Width(k_labelWidthDetail)); EditorGUILayout.LabelField("| GetContacts: " + GetPhysicsCounterValue(frameData, "GetContacts Queries"), GUILayout.Width(k_labelWidthDetail)); EditorGUILayout.LabelField("| Particle: " + GetPhysicsCounterValue(frameData, "Particle Queries"), GUILayout.Width(k_labelWidthDetail)); EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("Contacts", GUILayout.Width(k_labelWidthTitle)); EditorGUILayout.LabelField("| Total: " + GetPhysicsCounterValue(frameData, "Total Contacts"), GUILayout.Width(k_labelWidthDetail)); EditorGUILayout.LabelField("| Added: " + GetPhysicsCounterValue(frameData, "Added Contacts"), GUILayout.Width(k_labelWidthDetail)); EditorGUILayout.LabelField("| Removed: " + GetPhysicsCounterValue(frameData, "Removed Contacts"), GUILayout.Width(k_labelWidthDetail)); EditorGUILayout.LabelField("| Broadphase Updates: " + GetPhysicsCounterValue(frameData, "Broadphase Updates"), GUILayout.Width(k_labelWidthDetail)); EditorGUILayout.LabelField("| Broadphase Pairs: " + GetPhysicsCounterValue(frameData, "Broadphase Pairs"), GUILayout.Width(k_labelWidthDetail)); EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("Callbacks", GUILayout.Width(k_labelWidthTitle)); EditorGUILayout.LabelField("| Total: " + GetPhysicsCounterValue(frameData, "Total Callbacks"), GUILayout.Width(k_labelWidthDetail)); EditorGUILayout.LabelField("| Collision Enter: " + GetPhysicsCounterValue(frameData, "Collision Enter"), GUILayout.Width(k_labelWidthDetail)); EditorGUILayout.LabelField("| Collision Stay: " + GetPhysicsCounterValue(frameData, "Collision Stay"), GUILayout.Width(k_labelWidthDetail)); EditorGUILayout.LabelField("| Collision Exit: " + GetPhysicsCounterValue(frameData, "Collision Exit"), GUILayout.Width(k_labelWidthDetail)); EditorGUILayout.LabelField("| Trigger Enter: " + GetPhysicsCounterValue(frameData, "Trigger Enter"), GUILayout.Width(k_labelWidthDetail)); EditorGUILayout.LabelField("| Trigger Stay: " + GetPhysicsCounterValue(frameData, "Trigger Stay"), GUILayout.Width(k_labelWidthDetail)); EditorGUILayout.LabelField("| Trigger Exit: " + GetPhysicsCounterValue(frameData, "Trigger Exit"), GUILayout.Width(k_labelWidthDetail)); EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("Solver", GUILayout.Width(k_labelWidthTitle)); EditorGUILayout.LabelField("| World Count: " + GetPhysicsCounterValue(frameData, "Solver World Count"), GUILayout.Width(k_labelWidthDetail)); EditorGUILayout.LabelField("| Simulation Count: " + GetPhysicsCounterValue(frameData, "Solver Simulation Count"), GUILayout.Width(k_labelWidthDetail)); EditorGUILayout.LabelField("| Discrete Islands: " + GetPhysicsCounterValue(frameData, "Solver Discrete Islands"), GUILayout.Width(k_labelWidthDetail)); EditorGUILayout.LabelField("| Continuous Islands: " + GetPhysicsCounterValue(frameData, "Solver Continuous Islands"), GUILayout.Width(k_labelWidthDetail)); EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("Transform Sync", GUILayout.Width(k_labelWidthTitle)); EditorGUILayout.LabelField("| Sync Calls: " + GetPhysicsCounterValue(frameData, "Total Transform Sync Calls"), GUILayout.Width(k_labelWidthDetail)); EditorGUILayout.LabelField("| Sync Bodies: " + GetPhysicsCounterValue(frameData, "Transform Sync Bodies"), GUILayout.Width(k_labelWidthDetail)); EditorGUILayout.LabelField("| Sync Colliders: " + GetPhysicsCounterValue(frameData, "Transform Sync Colliders"), GUILayout.Width(k_labelWidthDetail)); EditorGUILayout.LabelField("| Parent Sync Bodies: " + GetPhysicsCounterValue(frameData, "Transform Parent Sync Bodies"), GUILayout.Width(k_labelWidthDetail)); EditorGUILayout.LabelField("| Parent Sync Colliders: " + GetPhysicsCounterValue(frameData, "Transform Parent Sync Colliders"), GUILayout.Width(k_labelWidthDetail)); EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("Joints", GUILayout.Width(k_labelWidthTitle)); EditorGUILayout.LabelField("| Total: " + GetPhysicsCounterValue(frameData, "Total Joints"), GUILayout.Width(k_labelWidthDetail)); EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("Timings", GUILayout.Width(k_labelWidthTitle)); EditorGUILayout.LabelField("| Sim: " + GetPhysicsSampleData(frameData, "Physics2D.Simulate"), GUILayout.Width(k_labelWidthDetail)); EditorGUILayout.LabelField("| Sync: " + GetPhysicsSampleData(frameData, "Physics2D.SyncTransformChanges"), GUILayout.Width(k_labelWidthDetail)); EditorGUILayout.LabelField("| Step: " + GetPhysicsSampleData(frameData, "Physics2D.Step"), GUILayout.Width(k_labelWidthDetail)); EditorGUILayout.LabelField("| Write: " + GetPhysicsSampleData(frameData, "Physics2D.UpdateTransforms"), GUILayout.Width(k_labelWidthDetail)); EditorGUILayout.LabelField("| Callbacks: " + GetPhysicsSampleData(frameData, "Physics2D.CompileContactCallbacks"), GUILayout.Width(k_labelWidthDetail)); EditorGUILayout.EndHorizontal(); } else { EditorGUILayout.LabelField("Current Data not Available."); } } else { // Determine if the old counters are available by looking for a counter only available there. if (!newCountersAvailable) { // Old data compatibility. var activeText = ProfilerDriver.GetOverviewText(ProfilerArea.Physics2D, ProfilerWindow.GetActiveVisibleFrameIndex()); var height = EditorStyles.wordWrappedLabel.CalcHeight(GUIContent.Temp(activeText), position.width); EditorGUILayout.SelectableLabel(activeText, EditorStyles.wordWrappedLabel, GUILayout.MinHeight(height)); } else { EditorGUILayout.LabelField("Legacy Data not Available."); } } } } GUILayout.EndScrollView(); }
void DrawNetworkOperationsPane(Rect position) { SplitterGUILayout.BeginHorizontalSplit(m_NetworkSplit); var overviewLabel = GUIContent.Temp(ProfilerDriver.GetOverviewText(area, ProfilerWindow.GetActiveVisibleFrameIndex())); var labelRect = GUILayoutUtility.GetRect(overviewLabel, EditorStyles.wordWrappedLabel); GUI.Label(labelRect, overviewLabel, EditorStyles.wordWrappedLabel); m_PaneScroll = GUILayout.BeginScrollView(m_PaneScroll, ProfilerWindow.Styles.background); EditorGUILayout.BeginHorizontal(EditorStyles.toolbar); EditorGUILayout.LabelField("Operation Detail"); EditorGUILayout.LabelField("Over 5 Ticks"); EditorGUILayout.LabelField("Over 10 Ticks"); EditorGUILayout.LabelField("Total"); EditorGUILayout.EndHorizontal(); EditorGUI.indentLevel += 1; for (short msgId = 0; msgId < msgNames.Length; msgId++) { #pragma warning disable CS0618 if (!NetworkDetailStats.m_NetworkOperations.ContainsKey(msgId)) #pragma warning restore { continue; } msgFoldouts[msgId] = EditorGUILayout.Foldout(msgFoldouts[msgId], msgNames[msgId] + ":"); if (msgFoldouts[msgId]) { EditorGUILayout.BeginVertical(); #pragma warning disable CS0618 var detail = NetworkDetailStats.m_NetworkOperations[msgId]; #pragma warning restore EditorGUI.indentLevel += 1; foreach (var entryName in detail.m_Entries.Keys) { int tick = (int)Time.time; var entry = detail.m_Entries[entryName]; if (entry.m_IncomingTotal > 0) { EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("IN:" + entryName); EditorGUILayout.LabelField(entry.m_IncomingSequence.GetFiveTick(tick).ToString()); EditorGUILayout.LabelField(entry.m_IncomingSequence.GetTenTick(tick).ToString()); EditorGUILayout.LabelField(entry.m_IncomingTotal.ToString()); EditorGUILayout.EndHorizontal(); } if (entry.m_OutgoingTotal > 0) { EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("OUT:" + entryName); EditorGUILayout.LabelField(entry.m_OutgoingSequence.GetFiveTick(tick).ToString()); EditorGUILayout.LabelField(entry.m_OutgoingSequence.GetTenTick(tick).ToString()); EditorGUILayout.LabelField(entry.m_OutgoingTotal.ToString()); EditorGUILayout.EndHorizontal(); } } EditorGUI.indentLevel -= 1; EditorGUILayout.EndVertical(); } } EditorGUI.indentLevel -= 1; GUILayout.EndScrollView(); SplitterGUILayout.EndHorizontalSplit(); // Draw separator var lineRect = new Rect(m_NetworkSplit.realSizes[0] + labelRect.xMin, position.y - EditorGUI.kWindowToolbarHeight - 1, 1, position.height + EditorGUI.kWindowToolbarHeight); EditorGUI.DrawRect(lineRect, s_SeparatorColor); }
public override void DrawDetailsView(Rect position) { EditorGUILayout.BeginHorizontal(EditorStyles.toolbar); ProfilerAudioView newShowDetailedAudioPane = m_ShowDetailedAudioPane; if (AudioDeepProfileToggle()) { if (GUILayout.Toggle(newShowDetailedAudioPane == ProfilerAudioView.Channels, "Channels", EditorStyles.toolbarButton)) { newShowDetailedAudioPane = ProfilerAudioView.Channels; } if (GUILayout.Toggle(newShowDetailedAudioPane == ProfilerAudioView.Groups, "Groups", EditorStyles.toolbarButton)) { newShowDetailedAudioPane = ProfilerAudioView.Groups; } if (GUILayout.Toggle(newShowDetailedAudioPane == ProfilerAudioView.ChannelsAndGroups, "Channels and groups", EditorStyles.toolbarButton)) { newShowDetailedAudioPane = ProfilerAudioView.ChannelsAndGroups; } if (Unsupported.IsDeveloperMode() && GUILayout.Toggle(newShowDetailedAudioPane == ProfilerAudioView.DSPGraph, "DSP Graph", EditorStyles.toolbarButton)) { newShowDetailedAudioPane = ProfilerAudioView.DSPGraph; } if (Unsupported.IsDeveloperMode() && GUILayout.Toggle(newShowDetailedAudioPane == ProfilerAudioView.Clips, "Clips", EditorStyles.toolbarButton)) { newShowDetailedAudioPane = ProfilerAudioView.Clips; } if (newShowDetailedAudioPane != m_ShowDetailedAudioPane) { m_ShowDetailedAudioPane = newShowDetailedAudioPane; m_LastAudioProfilerFrame = -1; // force update } if (m_ShowDetailedAudioPane == ProfilerAudioView.DSPGraph) { m_ShowInactiveDSPChains = GUILayout.Toggle(m_ShowInactiveDSPChains, "Show inactive", EditorStyles.toolbarButton); if (m_ShowInactiveDSPChains) { m_HighlightAudibleDSPChains = GUILayout.Toggle(m_HighlightAudibleDSPChains, "Highlight audible", EditorStyles.toolbarButton); } m_DSPGraphHorizontalLayout = GUILayout.Toggle(m_DSPGraphHorizontalLayout, "Horizontal Layout", EditorStyles.toolbarButton); GUILayout.FlexibleSpace(); EditorGUILayout.EndHorizontal(); var graphRect = DrawAudioStatsPane(ref m_PaneScroll_AudioDSPLeft); m_PaneScroll_AudioDSPRight_ScrollPos = GUI.BeginScrollView(graphRect, m_PaneScroll_AudioDSPRight_ScrollPos, new Rect(0, 0, m_PaneScroll_AudioDSPRight_Size.x, m_PaneScroll_AudioDSPRight_Size.y)); var clippingRect = new Rect(m_PaneScroll_AudioDSPRight_ScrollPos.x, m_PaneScroll_AudioDSPRight_ScrollPos.y, graphRect.width, graphRect.height); if (m_AudioProfilerDSPView == null) { m_AudioProfilerDSPView = new AudioProfilerDSPView(); } ProfilerProperty property = ProfilerWindow.CreateProperty(); if (property != null && property.frameDataReady) { using (property) { m_AudioProfilerDSPView.OnGUI(clippingRect, property, m_ShowInactiveDSPChains, m_HighlightAudibleDSPChains, m_DSPGraphHorizontalLayout, ref m_DSPGraphZoomFactor, ref m_PaneScroll_AudioDSPRight_ScrollPos, ref m_PaneScroll_AudioDSPRight_Size); } } GUI.EndScrollView(); } else if (m_ShowDetailedAudioPane == ProfilerAudioView.Clips) { GUILayout.FlexibleSpace(); EditorGUILayout.EndHorizontal(); var treeRect = DrawAudioStatsPane(ref m_PaneScroll_AudioClips); // TREE if (m_AudioProfilerClipTreeViewState == null) { m_AudioProfilerClipTreeViewState = new AudioProfilerClipTreeViewState(); } if (m_AudioProfilerClipViewBackend == null) { m_AudioProfilerClipViewBackend = new AudioProfilerClipViewBackend(m_AudioProfilerClipTreeViewState); } ProfilerProperty property = ProfilerWindow.CreateProperty(); if (property == null) { return; } if (!property.frameDataReady) { return; } using (property) { var currentFrame = ProfilerWindow.GetActiveVisibleFrameIndex(); if (currentFrame == -1 || m_LastAudioProfilerFrame != currentFrame) { m_LastAudioProfilerFrame = currentFrame; var sourceItems = property.GetAudioProfilerClipInfo(); if (sourceItems != null && sourceItems.Length > 0) { var items = new List <AudioProfilerClipInfoWrapper>(); foreach (var s in sourceItems) { items.Add(new AudioProfilerClipInfoWrapper(s, property.GetAudioProfilerNameByOffset(s.assetNameOffset))); } m_AudioProfilerClipViewBackend.SetData(items); if (m_AudioProfilerClipView == null) { m_AudioProfilerClipView = new AudioProfilerClipView(ProfilerWindow as EditorWindow, m_AudioProfilerClipTreeViewState); m_AudioProfilerClipView.Init(treeRect, m_AudioProfilerClipViewBackend); } } } if (m_AudioProfilerClipView != null) { m_AudioProfilerClipView.OnGUI(treeRect); } } } else { bool resetAllAudioClipPlayCountsOnPlay = GUILayout.Toggle(AudioUtil.resetAllAudioClipPlayCountsOnPlay, "Reset play count on play", EditorStyles.toolbarButton); if (resetAllAudioClipPlayCountsOnPlay != AudioUtil.resetAllAudioClipPlayCountsOnPlay) { AudioUtil.resetAllAudioClipPlayCountsOnPlay = resetAllAudioClipPlayCountsOnPlay; } if (Unsupported.IsDeveloperMode()) { GUILayout.Space(5); bool showAllGroups = EditorPrefs.GetBool("AudioProfilerShowAllGroups"); bool newShowAllGroups = GUILayout.Toggle(showAllGroups, "Show all groups (dev mode only)", EditorStyles.toolbarButton); if (showAllGroups != newShowAllGroups) { EditorPrefs.SetBool("AudioProfilerShowAllGroups", newShowAllGroups); } } GUILayout.FlexibleSpace(); EditorGUILayout.EndHorizontal(); var treeRect = DrawAudioStatsPane(ref m_PaneScroll_AudioChannels); // TREE if (m_AudioProfilerGroupTreeViewState == null) { m_AudioProfilerGroupTreeViewState = new AudioProfilerGroupTreeViewState(); } if (m_AudioProfilerGroupViewBackend == null) { m_AudioProfilerGroupViewBackend = new AudioProfilerGroupViewBackend(m_AudioProfilerGroupTreeViewState); } ProfilerProperty property = ProfilerWindow.CreateProperty(); if (property == null) { return; } if (!property.frameDataReady) { return; } using (property) { var currentFrame = ProfilerWindow.GetActiveVisibleFrameIndex(); if (currentFrame == -1 || m_LastAudioProfilerFrame != currentFrame) { m_LastAudioProfilerFrame = currentFrame; var sourceItems = property.GetAudioProfilerGroupInfo(); if (sourceItems != null && sourceItems.Length > 0) { var items = new List <AudioProfilerGroupInfoWrapper>(); var parentMapping = new Dictionary <int, AudioProfilerGroupInfo>(); foreach (var s in sourceItems) { parentMapping.Add(s.uniqueId, s); } foreach (var s in sourceItems) { bool isGroup = (s.flags & AudioProfilerGroupInfoHelper.AUDIOPROFILER_FLAGS_GROUP) != 0; if (m_ShowDetailedAudioPane == ProfilerAudioView.Channels && isGroup) { continue; } if (m_ShowDetailedAudioPane == ProfilerAudioView.Groups && !isGroup) { continue; } var wrapper = new AudioProfilerGroupInfoWrapper(s, property.GetAudioProfilerNameByOffset(s.assetNameOffset), property.GetAudioProfilerNameByOffset(s.objectNameOffset), m_ShowDetailedAudioPane == ProfilerAudioView.Channels); if (parentMapping.TryGetValue(s.parentId, out var parent)) { wrapper.parentName = property.GetAudioProfilerNameByOffset(parent.objectNameOffset); } else { wrapper.parentName = "ROOT"; } items.Add(wrapper); } m_AudioProfilerGroupViewBackend.SetData(items); if (m_AudioProfilerGroupView == null) { m_AudioProfilerGroupView = new AudioProfilerGroupView(ProfilerWindow as EditorWindow, m_AudioProfilerGroupTreeViewState); m_AudioProfilerGroupView.Init(treeRect, m_AudioProfilerGroupViewBackend); } } else { var items = new List <AudioProfilerGroupInfoWrapper>(); m_AudioProfilerGroupViewBackend.SetData(items); m_AudioProfilerGroupView = null; } } if (m_AudioProfilerGroupView != null) { m_AudioProfilerGroupView.OnGUI(treeRect, m_ShowDetailedAudioPane); } } } } else { GUILayout.FlexibleSpace(); EditorGUILayout.EndHorizontal(); DrawDetailsViewText(position); } ProfilerWindow.Repaint(); }