Ejemplo n.º 1
0
        /// <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);
        }
Ejemplo n.º 2
0
        /// <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);
        }
Ejemplo n.º 3
0
        public void Record(TimeInterval.Category category, Action action)
        {
            var interval = new TimeInterval(category);

            interval.sw.Start();
            action.Invoke();
            interval.sw.Stop();
            Shelve(interval);
        }