/// <summary> /// Starts a new MiniProfiler and associates it with the current <see cref="HttpContext.Current"/>. /// </summary> public override MiniProfiler Start(ProfileLevel level) { var context = HttpContext.Current; if (context == null) return null; var url = context.Request.Url; var path = context.Request.AppRelativeCurrentExecutionFilePath.Substring(1).ToUpperInvariant(); // don't profile /content or /scripts, either - happens in web.dev foreach (var ignored in StackExchange.Profiling.MiniProfiler.Settings.IgnoredPaths ?? new string[0]) { if (path.Contains((ignored ?? "").ToUpperInvariant())) return null; } if (context.Request.Path.StartsWith(VirtualPathUtility.ToAbsolute(MiniProfiler.Settings.RouteBasePath), StringComparison.InvariantCultureIgnoreCase)) { return null; } var result = new MiniProfiler(url.OriginalString, level); Current = result; SetProfilerActive(result); // don't really want to pass in the context to MiniProfler's constructor or access it statically in there, either result.User = Settings.UserProvider.GetUser(context.Request); return result; }
public override StackExchange.Profiling.MiniProfiler Start(ProfileLevel level, string sessionName = null) { _profiler = new StackExchange.Profiling.MiniProfiler(ConsoleProfiling.ProfilingUrl(), level); SetProfilerActive(_profiler); _profiler.User = ConsoleProfiling.CurrentUser(); return _profiler; }
/// <summary> /// Starts a new MiniProfiler and associates it with the current <see cref="HttpContext.Current"/>. /// </summary> public override Profiler Start(ProfileLevel level) { if (Request == null) { return(null); } var path = Request.RawUrl; // don't profile /content or /scripts, either - happens in web.dev foreach (var ignored in Profiler.Settings.IgnoredPaths ?? new string[0]) { if (path.ToUpperInvariant().Contains((ignored ?? "").ToUpperInvariant())) { return(null); } } var result = new Profiler(Request.Url.ToString(), level); Current = result; SetProfilerActive(result); // I'm not managing user yet result.User = RemoteIp; return(result); }
public override StackExchange.Profiling.MiniProfiler Start(ProfileLevel level) { _profiler = new StackExchange.Profiling.MiniProfiler(ConsoleProfiling.ProfilingUrl(), level); SetProfilerActive(_profiler); _profiler.User = ConsoleProfiling.CurrentUser(); return(_profiler); }
/// <summary> /// Starts a new MiniProfiler and associates it with the current <see cref="HttpContext.Current"/>. /// </summary> public override MiniProfiler Start(ProfileLevel level) { var context = HttpContext.Current; if (context == null) { return(null); } var url = context.Request.Url; var path = context.Request.AppRelativeCurrentExecutionFilePath.Substring(1); // don't profile /content or /scripts, either - happens in web.dev foreach (var ignored in MvcMiniProfiler.MiniProfiler.Settings.IgnoredPaths ?? new string[0]) { if (path.ToUpperInvariant().Contains((ignored ?? "").ToUpperInvariant())) { return(null); } } var result = new MiniProfiler(url.OriginalString, level); Current = result; SetProfilerActive(result); // don't really want to pass in the context to MiniProfler's constructor or access it statically in there, either result.User = (Settings.UserProvider ?? new IpAddressIdentity()).GetUser(context.Request); return(result); }
/// <summary> /// Starts a new MiniProfiler and associates it with the current <see cref="HttpContext.Current"/>. /// </summary> public override MiniProfiler Start(ProfileLevel level) { var context = HttpContext.Current; if (context == null) return null; var url = context.Request.Url; var path = context.Request.AppRelativeCurrentExecutionFilePath.Substring(1); // don't profile /content or /scripts, either - happens in web.dev foreach (var ignored in MvcMiniProfiler.MiniProfiler.Settings.IgnoredPaths ?? new string[0]) { if (path.ToUpperInvariant().Contains((ignored ?? "").ToUpperInvariant())) return null; } var result = new MiniProfiler(url.OriginalString, level); Current = result; SetProfilerActive(result); // don't really want to pass in the context to MiniProfler's constructor or access it statically in there, either result.User = (Settings.UserProvider ?? new IpAddressIdentity()).GetUser(context.Request); return result; }
public MiniProfiler(string url, ProfileLevel level = ProfileLevel.Info) : this(url) { #pragma warning disable 612,618 Level = level; #pragma warning restore 612,618 }
/// <summary> /// Starts a new profiling session. /// </summary> public MiniProfiler Start(ProfileLevel level, string sessionName = null) { _profiler = new MiniProfiler(sessionName ?? AppDomain.CurrentDomain.FriendlyName) { IsActive = true }; return(_profiler); }
/// <summary> /// The start. /// </summary> /// <param name="level"> /// The level. /// </param> /// <returns> /// The <see cref="MiniProfiler"/>. /// </returns> public MiniProfiler Start(ProfileLevel level) { _profiler = new MiniProfiler(AppDomain.CurrentDomain.FriendlyName) { IsActive = true }; return(_profiler); }
public static void EnableProfiling( this IMongoDatabase mongoDatabase, ProfileLevel profileLevel = ProfileLevel.All) { var profileCommand = new BsonDocument("profile", (int)profileLevel); mongoDatabase.RunCommand <BsonDocument>(profileCommand); }
public override MiniProfiler Start(ProfileLevel level) { var result = new MiniProfiler("TaskProfilerProvider<" + typeof(T).Name + ">", level); this.asyncProfiler = result; BaseProfilerProvider.SetProfilerActive(result); return(result); }
internal IDisposable StepImpl(string name, ProfileLevel level = ProfileLevel.Info) { if (level > this.Level) { return(null); } return(new Timing(this, Head, name)); }
/// <summary> /// Returns an <see cref="IDisposable"/> that will time the code between its creation and disposal. /// </summary> /// <param name="profiler">The current profiling session or null.</param> /// <param name="name">A descriptive name for the code that is encapsulated by the resulting IDisposable's lifetime.</param> /// <param name="level">This step's visibility level; allows filtering when <see cref="Profiler.Start"/> is called.</param> public static IDisposable Step(this Profiler profiler, string name, ProfileLevel level = ProfileLevel.Info) { if (CustomStepFn != null) { return(CustomStepFn(profiler, name)); } return(profiler == null ? null : profiler.StepImpl(name, level)); }
public ProfilingStatus( ProfileLevel level, int slowMs, double sampleRate, string filter) { Level = level; SlowMs = slowMs; SampleRate = sampleRate; Filter = filter; }
/// <summary> /// Returns an <see cref="IDisposable"/> that will time the code between its creation and disposal. /// </summary> /// <param name="profiler">The current profiling session or null.</param> /// <param name="name">A descriptive name for the code that is encapsulated by the resulting IDisposable's lifetime.</param> /// <param name="level">This step's visibility level; allows filtering when <see cref="MiniProfiler.Start"/> is called.</param> public static IDisposable Step(this IProfiler profiler, string name, ProfileLevel level) { var miniProfiler = profiler.GetMiniProfiler(); if (CustomStepFn != null) { return(CustomStepFn(miniProfiler, name)); } return(profiler == null ? null : miniProfiler.StepImpl(name, level)); }
public override MiniProfiler Start(ProfileLevel level, string sessionName = null) { if (HttpContext.Current != null) { return WebProfilerProvider.Start(level, sessionName); } // Anything not a web request goes HEREREEEEEEEERERERE! var contextProfiler = CreateContextProfiler(sessionName); SetProfilerActive(contextProfiler); return contextProfiler; }
/// <summary> /// Initialises a new instance of the <see cref="MiniProfiler"/> class. /// Creates and starts a new MiniProfiler for the root <paramref name="url"/>, filtering <see cref="Timing"/> steps to <paramref name="level"/>. /// </summary> /// <param name="url"> /// The URL. /// </param> /// <param name="level"> /// The level. /// </param> public MiniProfiler(string url, ProfileLevel level = ProfileLevel.Info) { Id = Guid.NewGuid(); Level = level; SqlProfiler = new SqlProfiler(this); MachineName = Environment.MachineName; Started = DateTime.UtcNow; // stopwatch must start before any child Timings are instantiated _sw = Settings.StopwatchProvider(); Root = new Timing(this, null, url); }
/// <summary> /// Creates and starts a new MiniProfiler for the root <paramref name="url"/>, filtering <see cref="Timing"/> steps to <paramref name="level"/>. /// </summary> public Profiler(string url, ProfileLevel level = ProfileLevel.Info) { Id = Guid.NewGuid(); Level = level; SqlProfiler = new SqlProfiler(this); MachineName = Environment.MachineName; Started = DateTime.UtcNow; // stopwatch must start before any child Timings are instantiated _sw = Settings.StopwatchProvider(); Root = new Timing(this, parent: null, name: url); }
/// <summary> /// start the profiler. /// </summary> /// <param name="level">The profile level.</param> /// <returns>the mini profiler.</returns> public override MiniProfiler Start(ProfileLevel level) { var context = WcfInstanceContext.Current; if (context == null) { return(null); } var operationContext = OperationContext.Current; if (operationContext == null) { return(null); } var instanceContext = operationContext.InstanceContext; if (instanceContext == null) { return(null); } // TODO: Include the action name here as well, and null protection string serviceName = instanceContext.Host.Description.Name; // BaseAddresses.FirstOrDefault(); // TODO: Ignored paths - currently solely based on servicename // var url = context.Request.Url; // var path = context.Request.AppRelativeCurrentExecutionFilePath.Substring(1); // don't profile /content or /scripts, either - happens in web.dev foreach (var ignored in MiniProfiler.Settings.IgnoredPaths ?? new string[0]) { if (serviceName.ToUpperInvariant().Contains((ignored ?? string.Empty).ToUpperInvariant())) { return(null); } } var result = new MiniProfiler(GetProfilerName(operationContext, instanceContext), level); SetCurrentProfiler(result); // don't really want to pass in the context to MiniProfler's constructor or access it statically in there, either result.User = (Settings.UserProvider ?? new EmptyUserProvider()).GetUser(/*context.Request*/); SetProfilerActive(result); return(result); }
public override MiniProfiler Start(ProfileLevel level, string sessionName = null) { if (HttpContext.Current != null) { return(WebProfilerProvider.Start(level, sessionName)); } // Anything not a web request goes HEREREEEEEEEERERERE! var contextProfiler = CreateContextProfiler(sessionName); SetProfilerActive(contextProfiler); return(contextProfiler); }
/// <summary> /// Initialises a new instance of the <see cref="MiniProfiler"/> class. Creates and starts a new MiniProfiler /// for the root <paramref name="url"/>, filtering <see cref="Timing"/> steps to <paramref name="level"/>. /// </summary> public MiniProfiler(string url, ProfileLevel level = ProfileLevel.Info) { Id = Guid.NewGuid(); #pragma warning disable 612,618 Level = level; #pragma warning restore 612,618 SqlProfiler = new SqlProfiler(this); MachineName = Environment.MachineName; Started = DateTime.UtcNow; // stopwatch must start before any child Timings are instantiated _sw = Settings.StopwatchProvider(); Root = new Timing(this, null, url); }
/// <summary> /// Executed when a profiling operation is started /// </summary> /// <param name="level"></param> /// <returns></returns> /// <remarks> /// This checks if the startup phase is not None, if this is the case and the current profiler is NULL /// then this sets the startup profiler to be active. Otherwise it just calls the base class Start method. /// </remarks> public override MiniProfiler Start(ProfileLevel level) { var first = Interlocked.Exchange(ref _first, 1) == 0; if (first == false) { return(base.Start(level)); } _startupProfiler = new MiniProfiler("http://localhost/umbraco-startup") { Name = "StartupProfiler" }; SetProfilerActive(_startupProfiler); return(_startupProfiler); }
/// <summary> /// start the profiler. /// </summary> /// <param name="level">The profile level.</param> /// <returns>the mini profiler.</returns> public override MiniProfiler Start(ProfileLevel level, string sessionName = null) { var context = WcfInstanceContext.Current; if (context == null) return null; var operationContext = OperationContext.Current; if (operationContext == null) return null; var instanceContext = operationContext.InstanceContext; if (instanceContext == null) return null; // TODO: Include the action name here as well, and null protection string serviceName = instanceContext.Host.Description.Name; // BaseAddresses.FirstOrDefault(); // TODO: Ignored paths - currently solely based on servicename // var url = context.Request.Url; // var path = context.Request.AppRelativeCurrentExecutionFilePath.Substring(1); // don't profile /content or /scripts, either - happens in web.dev foreach (var ignored in MiniProfiler.Settings.IgnoredPaths ?? new string[0]) { if (serviceName.ToUpperInvariant().Contains((ignored ?? string.Empty).ToUpperInvariant())) return null; } var result = new MiniProfiler(sessionName ?? GetProfilerName(operationContext, instanceContext), level); SetCurrentProfiler(result); // don't really want to pass in the context to MiniProfler's constructor or access it statically in there, either result.User = (Settings.UserProvider ?? new EmptyUserProvider()).GetUser(/*context.Request*/); SetProfilerActive(result); return result; }
/// <summary> /// Starts a new MiniProfiler and associates it with the current <see cref="HttpContext.Current"/>. /// </summary> public override Profiler Start(ProfileLevel level) { if (Request == null) return null; var path = Request.RawUrl; // don't profile /content or /scripts, either - happens in web.dev foreach (var ignored in Profiler.Settings.IgnoredPaths ?? new string[0]) { if (path.ToUpperInvariant().Contains((ignored ?? "").ToUpperInvariant())) return null; } var result = new Profiler(Request.Url.ToString(), level); Current = result; SetProfilerActive(result); // I'm not managing user yet result.User = RemoteIp; return result; }
/// <summary> /// Starts a new MiniProfiler and associates it with the current <see cref="HttpContext.Current"/>. /// </summary> public override MiniProfiler Start(ProfileLevel level) { var context = HttpContext.Current; if (context == null) { return(null); } var url = context.Request.Url; var path = context.Request.AppRelativeCurrentExecutionFilePath.Substring(1).ToUpperInvariant(); // don't profile /content or /scripts, either - happens in web.dev foreach (var ignored in StackExchange.Profiling.MiniProfiler.Settings.IgnoredPaths ?? new string[0]) { if (path.Contains((ignored ?? "").ToUpperInvariant())) { return(null); } } if (context.Request.Path.StartsWith(VirtualPathUtility.ToAbsolute(MiniProfiler.Settings.RouteBasePath), StringComparison.InvariantCultureIgnoreCase)) { return(null); } var result = new MiniProfiler(url.OriginalString, level); Current = result; SetProfilerActive(result); // don't really want to pass in the context to MiniProfler's constructor or access it statically in there, either result.User = Settings.UserProvider.GetUser(context.Request); return(result); }
public override MiniProfiler Start(ProfileLevel level) { var context = WcfInstanceContext.Current; if (context == null) return null; var operationContext = OperationContext.Current; if (operationContext == null) return null; var instanceContext = operationContext.InstanceContext; if (instanceContext == null) return null; var webOperationContext = WebOperationContext.Current; if((webOperationContext == null) == true) return null; if (webOperationContext.IncomingRequest.UriTemplateMatch == null) return null; var result = new MiniProfiler(GetProfilerName(operationContext, instanceContext), level); result.Root.AddKeyValue("requesturl",operationContext.IncomingMessageHeaders.To.OriginalString); result.Root.AddKeyValue("method", webOperationContext.IncomingRequest.Method); SetCurrentProfiler(result); SetProfilerActive(result); return result; }
internal IDisposable StepImpl(string name, ProfileLevel level) { return level > Level ? null : StepImpl(name); }
public static MiniProfiler Start(ProfileLevel level, string sessionName = null) { Settings.EnsureProfilerProvider(); return Settings.ProfilerProvider.Start(level, sessionName); }
public static IDisposable StepStatic(string name, ProfileLevel level) { return Current.Step(name, level); }
internal IDisposable StepImpl(string name, ProfileLevel level) { return(level > Level ? null : StepImpl(name)); }
public static MiniProfiler Start(ProfileLevel level, string sessionName = null) { Settings.EnsureProfilerProvider(); return(Settings.ProfilerProvider.Start(level, sessionName)); }
public override MiniProfiler Start(ProfileLevel level, string sessionName = null) { _current = new MiniProfiler(sessionName); return(_current); }
public override MiniProfiler Start(ProfileLevel level, string sessionName = null) { _current = new MiniProfiler(sessionName); return _current; }
public override StackExchange.Profiling.MiniProfiler Start(ProfileLevel level, string sessionName = null) { return(Start(sessionName)); }
/// <summary> /// Starts a new MiniProfiler and sets it to be current. By the end of this method /// <see cref="GetCurrentProfiler"/> should return the new MiniProfiler. /// </summary> /// <param name="level"> /// The level. /// </param> /// <returns> /// The <see cref="MiniProfiler"/>. /// </returns> public abstract MiniProfiler Start(ProfileLevel level);
public override StackExchange.Profiling.MiniProfiler Start(ProfileLevel level, string sessionName = null) { return this.Start(sessionName: sessionName); }
/// <summary> /// Starts a new profiling session. /// </summary> public MiniProfiler Start(ProfileLevel level, string sessionName = null) { _profiler = new MiniProfiler(sessionName ?? AppDomain.CurrentDomain.FriendlyName) { IsActive = true }; return _profiler; }
internal IDisposable StepImpl(string name, ProfileLevel level = ProfileLevel.Info) { return level > Level ? null : new Timing(this, Head, name); }
/// <summary> /// Starts a new MiniProfiler and sets it to be current. By the end of this method /// <see cref="GetCurrentProfiler"/> should return the new MiniProfiler. /// </summary> public abstract MiniProfiler Start(ProfileLevel level, string sessionName = null);
public void WhenIRequestALevelForPoints(int p0) { _result = _service.GetLevelForPoints(p0); }
/// <summary> /// Starts a new MiniProfiler and sets it to be current. By the end of this method /// <see cref="GetCurrentProfiler"/> should return the new MiniProfiler. /// </summary> public abstract Profiler Start(ProfileLevel level);
public MiniProfiler Start(ProfileLevel level, string sessionName = null) { return Start(sessionName); }
/// <summary> /// The start. /// </summary> /// <param name="level"> /// The level. /// </param> /// <returns> /// The <see cref="MiniProfiler"/>. /// </returns> public MiniProfiler Start(ProfileLevel level) { _profiler = new MiniProfiler(AppDomain.CurrentDomain.FriendlyName) { IsActive = true }; return _profiler; }
public StackExchange.Profiling.MiniProfiler Start(ProfileLevel level, string sessionName = null) { return(profileProvider.Start(level, sessionName)); }
/// <summary> /// Returns an <see cref="IDisposable"/> that will time the code between its creation and disposal. Use this method when you /// do not wish to include the MvcMiniProfiler namespace for the <see cref="MiniProfilerExtensions.Step"/> extension method. /// </summary> /// <param name="name">A descriptive name for the code that is encapsulated by the resulting IDisposable's lifetime.</param> /// <param name="level">This step's visibility level; allows filtering when <see cref="Profiler.Start"/> is called.</param> public static IDisposable StepStatic(string name, ProfileLevel level = ProfileLevel.Info) { return(MiniProfilerExtensions.Step(Current, name, level)); }
/// <summary> /// Starts a new MiniProfiler based on the current <see cref="IProfilerProvider"/>. This new profiler can be accessed by /// <see cref="MiniProfiler.Current"/> /// </summary> /// <param name="level">The level.</param> /// <returns>the mini profiler.</returns> public static MiniProfiler Start(ProfileLevel level = ProfileLevel.Info) { Settings.EnsureProfilerProvider(); return Settings.ProfilerProvider.Start(level); }
public MiniProfiler Start(ProfileLevel level, string sessionName = null) { return(Start(sessionName)); }
/// <summary> /// Starts a new MiniProfiler based on the current <see cref="IProfilerProvider"/>. This new profiler can be accessed by /// <see cref="Profiler.Current"/> /// </summary> public static Profiler Start(ProfileLevel level = ProfileLevel.Info) { Settings.EnsureProfilerProvider(); return(Settings.ProfilerProvider.Start(level)); }
/// <summary> /// The step implementation. /// </summary> /// <param name="name">The name.</param> /// <param name="level">The level.</param> /// <returns>the step.</returns> internal IDisposable StepImpl(string name, ProfileLevel level = ProfileLevel.Info) { if (level > Level) return null; return new Timing(this, Head, name); }
public static IDisposable StepStatic(string name, ProfileLevel level) { return(Current.Step(name, level)); }
internal IDisposable StepImpl(string name, ProfileLevel level = ProfileLevel.Info) { return(level > Level ? null : new Timing(this, Head, name)); }