public Section( Profiler profiler, Section parent, string name ) { this.profiler = profiler; this.parent = parent; this.name = name; this.fullName = String.Format("{0}{1}", (parent != null ? string.Format("{0}.", parent.FullName) : ""), name); this.allocatedAtFrame = profiler.FrameNumber; this.childrenMap = new Dictionary <string, Section>(); this.childrenList = new List <Section>(); frameStatistics = new FrameStatistics[NumFrameStatistics]; for (int i = 0; i < NumFrameStatistics; ++i) { frameStatistics[i].Initialized = false; } currentStatistics = 0; totalStatistics = new FrameStatistics(); totalFrameCount = 0; peakStatistics = new FrameStatistics(); }
private int DrawSection(GraphicsDevice graphics, Section section, int x, int y, int titleSafeX, bool showAlways) { int sectionHeight = 0; showAlways = showAlways || filterList.Contains(string.Format("{0}.*", section.FullName)); if (filterList.Contains(section.FullName) || showAlways) { spriteBatch.DrawString(font, section.Name, new Vector2(x, y), Color.Yellow); sectionHeight += (int)font.MeasureString(section.Name).Y + 2; FrameStatistics totalStats = section.TotalStatistics; FrameStatistics peakStats = section.PeakStatistics; FrameStatistics currentStats = section.CurrentStatistics; spriteBatch.DrawString( font, string.Format("{0:0.00000000}", currentStats.AccumulatedTime / (double)currentStats.CallCount), new Vector2(titleSafeX + 500, y), Color.Yellow); spriteBatch.DrawString( font, string.Format("{0:0.00000000}", totalStats.AccumulatedTime / (double)totalStats.CallCount), new Vector2(titleSafeX + 750, y), Color.Yellow); spriteBatch.DrawString( font, string.Format("{0:0.00000000}", peakStats.AccumulatedTime / (double)peakStats.CallCount), new Vector2(titleSafeX + 1000, y), Color.Yellow); } for (int i = 0; i < section.ChildCount; ++i) { sectionHeight += DrawSection(graphics, section[i], x + 20, y + sectionHeight, titleSafeX, showAlways); } return(sectionHeight); }