Timer: don't automatically DumpStats(); refactor string prefixes during dump
GitOrigin-RevId: 93b7d652823785b2be1074af50dbe4952e288856
This commit is contained in:
parent
5672e292cc
commit
d30be7a460
@ -27,9 +27,6 @@ namespace SemiColinGames {
|
|||||||
double frameTime = stopwatch.Elapsed.TotalSeconds - startTime;
|
double frameTime = stopwatch.Elapsed.TotalSeconds - startTime;
|
||||||
int bucket = FMath.Clamp((int) (10.0f * frameTime / targetTime), 0, 20);
|
int bucket = FMath.Clamp((int) (10.0f * frameTime / targetTime), 0, 20);
|
||||||
histogram[bucket]++;
|
histogram[bucket]++;
|
||||||
if (totalFrames % 100 == 0) {
|
|
||||||
DumpStats();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void DumpStats() {
|
public void DumpStats() {
|
||||||
@ -41,9 +38,11 @@ namespace SemiColinGames {
|
|||||||
}
|
}
|
||||||
// Every star is one percent.
|
// Every star is one percent.
|
||||||
int numStars = FMath.Clamp(100 * value / totalFrames, 1, 100);
|
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) {
|
if (i == histogram.Length - 1) {
|
||||||
prefix = " 200+%: ";
|
prefix = " 200+%: ";
|
||||||
|
} else {
|
||||||
|
prefix = String.Format("{0,3}-{1,3}%: ", i * 10, (i + 1) * 10);
|
||||||
}
|
}
|
||||||
string stars = new string('*', numStars);
|
string stars = new string('*', numStars);
|
||||||
Debug.WriteLine(String.Format("{0}{1,-100} {2}", prefix, stars, value));
|
Debug.WriteLine(String.Format("{0}{1,-100} {2}", prefix, stars, value));
|
||||||
|
Loading…
Reference in New Issue
Block a user