Browse Source

Timer: don't automatically DumpStats(); refactor string prefixes during dump

GitOrigin-RevId: 93b7d65282
master
Colin McMillen 4 years ago
parent
commit
d30be7a460
  1. 7
      Shared/Timer.cs

7
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));

Loading…
Cancel
Save