/// <summary> /// Starts the stopwatch of a new TimeInterval, and adds the interval to the stack. /// </summary> public void Start(TimeInterval.Category category) { var interval = new TimeInterval(category); interval.sw.Start(); _intervals.Push(interval); }
/// <summary> /// Gets the next TimeInterval on the stack, stops the stopwatch inside, and saves the interval. /// </summary> public void Stop(TimeInterval.Category category) { var interval = _intervals.Pop(); interval.sw.Stop(); Shelve(interval); }
public void Record(TimeInterval.Category category, Action action) { var interval = new TimeInterval(category); interval.sw.Start(); action.Invoke(); interval.sw.Stop(); Shelve(interval); }