void plot_VisibleChanged(object sender, EventArgs e) { var plot = sender as Plot; if (!plot.Visible) { // Disabled _labels.HideLabel(plot.TitleLabelName); _labels.HideLabel(plot.MinLabelName); _labels.HideLabel(plot.MaxLabelName); if (!Config.HiddenPlots.Contains(plot.Sampler.Name) && _plotBeignRemoved != plot) { Config.HiddenPlots.Add(plot.Sampler.Name); } } else { // Enabled if (Config.HiddenPlots.Contains(plot.Sampler.Name)) { Config.HiddenPlots.Remove(plot.Sampler.Name); } } }
internal void Draw(InternalLabeler labeler, ProfilerManager.FrameLog frameLog) { if (GearsetResources.CurrentRenderPass != RenderPass.BasicEffectPass) { return; } if (frameLog == null || Visible == false || Config.PerformanceGraphConfig.VisibleLevelsFlags == 0) { labeler.HideLabel("__performanceGraph"); return; } DrawBorderLines(Color.Gray, Profiler.LineDrawer); GearsetResources.Console.SolidBoxDrawer.ShowGradientBoxOnce(Position, Position + Size, new Color(56, 56, 56, 150), new Color(16, 16, 16, 127)); if (ScaleNob.IsMouseOver) { ScaleNob.DrawBorderLines(Color.Gray); } labeler.ShowLabel("__performanceGraph", Position + new Vector2(0, -12), "Performance Graph"); FrameCounter++; if (FrameCounter > SkipFrames) { FrameCounter = 0; //If the frame buffer has capacity will just create a new one; otherwise we'll pop the oldest off and use that. Frame frame; if (_frames.Count == MaxFrames) { frame = _frames.Dequeue(); frame.TimingInfos.Clear(); } else { frame = new Frame(); } _frames.Enqueue(frame); //Populate the frame metrics for (var barId = 0; barId < frameLog.Levels.Length; barId++) { var bar = frameLog.Levels[barId]; for (var j = 0; j < bar.MarkCount; ++j) { frame.TimingInfos.Add(new TimingInfo( barId, bar.Markers[j].BeginTime, bar.Markers[j].EndTime, bar.Markers[j].Color)); } } } const float frameSpan = 1.0f / 60.0f * 1000f; var msToPs = Height / frameSpan; //Only render the actual number of frames we are capturing - we may have space for e.g. 120 (2 seconds) but the user is only viewing 60 (1 second) var barWidth = Width / DisplayedFrameCount; var graphFloor = Position.Y + Size.Y; var position = new Vector2(Position.X, graphFloor); var s = new Vector2(barWidth, msToPs); //Set a pointer to the first frame to renders var frameId = MaxFrames - DisplayedFrameCount; foreach (var frame in _frames) { //Bail when we have drawn enough if (frameId >= MaxFrames) { break; } frameId++; foreach (var timeInfo in frame.TimingInfos) { if (IsVisibleLevelsFlagSet(timeInfo.Level) == false) { continue; } var durationMilliseconds = timeInfo.EndMilliseconds - timeInfo.StartMilliseconds; if (durationMilliseconds <= 0) { continue; } s.Y = -durationMilliseconds * msToPs; position.Y = graphFloor - (timeInfo.StartMilliseconds * msToPs); Profiler.TempBoxDrawer.ShowGradientBoxOnce(position, position + s, timeInfo.Color, timeInfo.Color); } position.X += barWidth; } }
internal void Draw(InternalLabeler labeler, Profiler.FrameLog frameLog) { if (Visible == false || Config.ProfilerSummaryConfig.VisibleLevelsFlags == 0) { labeler.HideLabel("__profilerSummary"); return; } var font = GearsetResources.Font; // Generate log string. _logString.Length = 0; _logStringTimings.Length = 0; foreach (var markerInfo in Profiler.Markers) { for (var i = 0; i < Profiler.MaxLevels; ++i) { if (!markerInfo.Logs[i].Initialized) continue; if (Levels[i].Enabled == false) continue; if (_logString.Length > 0) { _logString.Append("\n"); _logStringTimings.Append("\n"); } _logString.Append(" Level "); _logString.AppendNumber(i); _logString.Append(" "); //Indent! for (var x = 0; x < i; x++) _logString.Append("--"); _logString.Append(markerInfo.Name); //_logStringTimings.Append(" Avg.:"); _logStringTimings.AppendNumber(markerInfo.Logs[i].SnapAvg); _logStringTimings.Append(" ms "); } } var namesSize = font.MeasureString(_logString); var timingsSize = font.MeasureString(_logStringTimings); Size = namesSize + new Vector2(timingsSize.X, 0) + new Vector2(Padding * 5, Padding * 2); if (GearsetResources.CurrentRenderPass == RenderPass.BasicEffectPass) { DrawBorderLines(Color.Gray); GearsetResources.Console.SolidBoxDrawer.ShowGradientBoxOnce(Position, Position + Size, new Color(56, 56, 56, 150), new Color(16, 16, 16, 127)); //Fixed size based on summary contrents //if (ScaleNob.IsMouseOver) // ScaleNob.DrawBorderLines(Color.Gray); labeler.ShowLabel("__profilerSummary", Position + new Vector2(0, -12), "Profiler Summary"); // Draw log color boxes. var position = Position; position += new Vector2(Padding); foreach (var markerInfo in Profiler.Markers) { for (var i = 0; i < Profiler.MaxLevels; ++i) { if (Levels[i].Enabled == false) continue; if (markerInfo.Logs[i].Initialized == false) continue; Profiler.TempBoxDrawer.ShowGradientBoxOnce(position, position + new Vector2(10), markerInfo.Logs[i].Color, markerInfo.Logs[i].Color); position.Y += font.LineSpacing; } } } if (GearsetResources.CurrentRenderPass == RenderPass.SpriteBatchPass) { // Draw log string. var position = Position; position += new Vector2(Padding * 3, Padding); GearsetResources.SpriteBatch.DrawString(font, _logString, position, new Color(180, 180, 180)); position = Position; position += new Vector2(namesSize.X + (Padding * 5), Padding); GearsetResources.SpriteBatch.DrawString(font, _logStringTimings, position, new Color(220, 220, 220)); } }
static void HideLabels(InternalLabeler labeler) { labeler.HideLabel(LabelName.Title); labeler.HideLabel(LabelName.Gen0Label); labeler.HideLabel(LabelName.Gen0); labeler.HideLabel(LabelName.Gen1Label); labeler.HideLabel(LabelName.Gen1); labeler.HideLabel(LabelName.Gen2Label); labeler.HideLabel(LabelName.Gen2); labeler.HideLabel(LabelName.XboxLabel); labeler.HideLabel(LabelName.Xbox); labeler.HideLabel(LabelName.MinYAxis); labeler.HideLabel(LabelName.MaxYAxis); }
internal void Draw(InternalLabeler labeler, Profiler.FrameLog frameLog) { if (GearsetResources.CurrentRenderPass != RenderPass.BasicEffectPass) return; if (Visible == false || Config.PerformanceGraphConfig.VisibleLevelsFlags == 0) { labeler.HideLabel("__performanceGraph"); return; } DrawBorderLines(Color.Gray); GearsetResources.Console.SolidBoxDrawer.ShowGradientBoxOnce(Position, Position + Size, new Color(56, 56, 56, 150), new Color(16, 16, 16, 127)); if (ScaleNob.IsMouseOver) ScaleNob.DrawBorderLines(Color.Gray); labeler.ShowLabel("__performanceGraph", Position + new Vector2(0, -12), "Performance Graph"); _frameCounter++; if (_frameCounter > SkipFrames) { _frameCounter = 0; //If the frame buffer has capacity will just create a new one; otherwise we'll pop the oldest off and use that. Frame frame; if (_frames.Count == MaxFrames) { frame = _frames.Dequeue(); frame.TimingInfos.Clear(); } else frame = new Frame(); _frames.Enqueue(frame); //Populate the frame metrics for (var barId = 0; barId < frameLog.Levels.Length; barId++) { var bar = frameLog.Levels[barId]; for (var j = 0; j < bar.MarkCount; ++j) { frame.TimingInfos.Add(new TimingInfo( barId, bar.Markers[j].BeginTime, bar.Markers[j].EndTime, bar.Markers[j].Color)); } } } const float frameSpan = 1.0f / 60.0f * 1000f; var msToPs = Height / frameSpan; //Only render the actual number of frames we are capturing - we may have space for e.g. 120 (2 seconds) but the user is only viewing 60 (1 second) var barWidth = Width / DisplayedFrameCount; var graphFloor = Position.Y + Size.Y; var position = new Vector2(Position.X, graphFloor); var s = new Vector2(barWidth, msToPs); //Set a pointer to the first frame to renders var frameId = MaxFrames - DisplayedFrameCount; foreach (var frame in _frames) { //Bail when we have drawn enough if (frameId >= MaxFrames) break; frameId++; foreach (var timeInfo in frame.TimingInfos) { if (Levels[timeInfo.Level].Enabled == false) continue; var durationMilliseconds = timeInfo.EndMilliseconds - timeInfo.StartMilliseconds; if (durationMilliseconds <= 0) continue; s.Y = -durationMilliseconds * msToPs; position.Y = graphFloor - (timeInfo.StartMilliseconds * msToPs); Profiler.TempBoxDrawer.ShowGradientBoxOnce(position, position + s, timeInfo.Color, timeInfo.Color); } position.X += barWidth; } }
internal void Draw(InternalLabeler labeler, ProfilerManager.FrameLog frameLog) { if (frameLog == null || Visible == false || Config.ProfilerSummaryConfig.VisibleLevelsFlags == 0) { labeler.HideLabel("__profilerSummary"); return; } var font = GearsetResources.Font; // Generate log string. _logString.Length = 0; _logStringTimings.Length = 0; foreach (var markerInfo in Profiler.Markers) { for (var i = 0; i < ProfilerManager.MaxLevels; ++i) { if (!markerInfo.Logs[i].Initialized) { continue; } if (IsVisibleLevelsFlagSet(i) == false) { continue; } if (_logString.Length > 0) { _logString.Append("\n"); _logStringTimings.Append("\n"); } _logString.Append(" Level "); _logString.AppendNumber(i); _logString.Append(" "); //Indent! for (var x = 0; x < i; x++) { _logString.Append("--"); } _logString.Append(markerInfo.Name); //_logStringTimings.Append(" Avg.:"); _logStringTimings.AppendNumber(markerInfo.Logs[i].SnapAvg); _logStringTimings.Append(" ms "); } } var namesSize = font.MeasureString(_logString); var timingsSize = font.MeasureString(_logStringTimings); Size = namesSize + new Vector2(timingsSize.X, 0) + new Vector2(Padding * 5, Padding * 2); if (GearsetResources.CurrentRenderPass == RenderPass.BasicEffectPass) { DrawBorderLines(Color.Gray, Profiler.LineDrawer); GearsetResources.Console.SolidBoxDrawer.ShowGradientBoxOnce(Position, Position + Size, new Color(56, 56, 56, 150), new Color(16, 16, 16, 127)); //Fixed size based on summary contrents //if (ScaleNob.IsMouseOver) // ScaleNob.DrawBorderLines(Color.Gray); labeler.ShowLabel("__profilerSummary", Position + new Vector2(0, -12), "Profiler Summary"); // Draw log color boxes. var position = Position; position += new Vector2(Padding); foreach (var markerInfo in Profiler.Markers) { for (var i = 0; i < ProfilerManager.MaxLevels; ++i) { if (IsVisibleLevelsFlagSet(i) == false) { continue; } if (markerInfo.Logs[i].Initialized == false) { continue; } Profiler.TempBoxDrawer.ShowGradientBoxOnce(position, position + new Vector2(10), markerInfo.Logs[i].Color, markerInfo.Logs[i].Color); position.Y += font.LineSpacing; } } } if (GearsetResources.CurrentRenderPass == RenderPass.SpriteBatchPass) { // Draw log string. var position = Position; position += new Vector2(Padding * 3, Padding); GearsetResources.SpriteBatch.DrawString(font, _logString, position, new Color(180, 180, 180)); position = Position; position += new Vector2(namesSize.X + (Padding * 5), Padding); GearsetResources.SpriteBatch.DrawString(font, _logStringTimings, position, new Color(220, 220, 220)); } }