/// <summary>
        /// Submits a timing directly.
        /// </summary>
        /// <param name="profiler">The profiler.</param>
        /// <param name="key">The key.</param>
        /// <param name="value">The timing value.</param>
        public static void Timing(this MetricsPipe profiler, string key, long value)
        {
            if (profiler == null)
            {
                return;
            }

            profiler.ReportTiming(key, value);
        }
        /// <summary>
        /// Times a step with specified key.
        /// </summary>
        /// <param name="profiler">The profiler.</param>
        /// <param name="key">The key.</param>
        /// <returns></returns>
        public static IDisposable Step(this MetricsPipe profiler, string key)
        {
            if (profiler == null)
            {
                return(null);
            }

            var timing = profiler.StartTiming();

            return(new Reporter(() =>
            {
                timing.Dispose();

                int?elapsed = timing.ComputeElapsedMilliseconds();

                if (elapsed.HasValue)
                {
                    profiler.ReportTiming(key, elapsed.Value);
                }
            }));
        }