From d30be7a4606e09fbc30af4c212d7272ae8b7a6b6 Mon Sep 17 00:00:00 2001 From: Colin McMillen Date: Tue, 4 Feb 2020 09:54:21 -0500 Subject: [PATCH] Timer: don't automatically DumpStats(); refactor string prefixes during dump GitOrigin-RevId: 93b7d652823785b2be1074af50dbe4952e288856 --- Shared/Timer.cs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/Shared/Timer.cs b/Shared/Timer.cs index 883edd2..31cd058 100644 --- a/Shared/Timer.cs +++ b/Shared/Timer.cs @@ -27,9 +27,6 @@ namespace SemiColinGames { double frameTime = stopwatch.Elapsed.TotalSeconds - startTime; int bucket = FMath.Clamp((int) (10.0f * frameTime / targetTime), 0, 20); histogram[bucket]++; - if (totalFrames % 100 == 0) { - DumpStats(); - } } public void DumpStats() { @@ -41,9 +38,11 @@ namespace SemiColinGames { } // Every star is one percent. int numStars = FMath.Clamp(100 * value / totalFrames, 1, 100); - string prefix = String.Format("{0,3}-{1,3}%: ", i * 10, (i + 1) * 10); + string prefix; if (i == histogram.Length - 1) { prefix = " 200+%: "; + } else { + prefix = String.Format("{0,3}-{1,3}%: ", i * 10, (i + 1) * 10); } string stars = new string('*', numStars); Debug.WriteLine(String.Format("{0}{1,-100} {2}", prefix, stars, value));