/// <summary>
 /// Stops the current profiling session.
 /// </summary>
 public void Stop(bool discardResults)
 {
     if (_profiler != null)
     {
         _profiler.StopImpl();
     }
 }
        /// <summary>
        /// Stops the profiler and marks it as inactive.
        /// </summary>
        /// <returns>True if successful, false if Stop had previously been called on this profiler</returns>
        /// <exception cref="ArgumentNullException">If <paramref name="profiler"/> is null</exception>
        protected static bool StopProfiler(MiniProfiler profiler)
        {
            if (profiler == null)
            {
                throw new ArgumentNullException("profiler");
            }

            if (!profiler.StopImpl())
            {
                return(false);
            }

            profiler.IsActive = false;
            return(true);
        }