public Entry Get(string name) { if (Entries.ContainsKey (name)) { return Entries [name]; } else { Entry newEntry = new Entry (name); Entries.Add (name, newEntry); return newEntry; } }
public void CheckIn(string name, Action action) { Entry previous = Current; if (previous != null) previous.Stop (stopwatch.ElapsedTicks); Current = Entries.Get (name); Current.Start (stopwatch.ElapsedTicks); action.Invoke (); Current.Stop (stopwatch.ElapsedTicks); if (previous != null) previous.Start (stopwatch.ElapsedTicks); Current = previous; }