public DebugOverlay Histogram(float val) { if (_histogram == null) { _histogram = new DebugHistogram(200); _histogram.height = 50; _histogram.position = new Vector2(300f, 10f); } _histogram.Push(val); return(this); }
public static void PawnGenerationHistogram() { DebugHistogram debugHistogram = new DebugHistogram((from x in Enumerable.Range(1, 20) select(float) x * 10f).ToArray()); for (int i = 0; i < 100; i++) { long timestamp = Stopwatch.GetTimestamp(); Pawn pawn = GeneratePawn(new PawnGenerationRequest(PawnKindDefOf.Colonist, null, PawnGenerationContext.NonPlayer, -1, forceGenerateNewPawn: true)); debugHistogram.Add((float)((Stopwatch.GetTimestamp() - timestamp) * 1000 / Stopwatch.Frequency)); pawn.Destroy(); } debugHistogram.Display(); }
void Clear() { _texts.Clear(); _histogram = null; }