public string AllAccumulatedTimes(string prefix = "Times:", string separator = " ") { var b = new StringBuilder(); b.Append(prefix + " "); foreach (string label in Order) { TimeSpan span = Timers[label].Accumulated; b.Append(label + ": " + string.Format(BlockTimer.TimeFormatString(span), span) + separator); } return(b.ToString()); }
public BlockTimer Start(string label) { if (Timers.ContainsKey(label)) { Timers[label].Reset(); } else { Timers[label] = new BlockTimer(label, true); Order.Add(label); } return(Timers[label]); }
public string Accumulated(string label) { TimeSpan accum = Timers[label].Accumulated; return(string.Format(BlockTimer.TimeFormatString(accum), accum)); }