diff --git a/NzbDrone.Web/App_Start/MiniProfiler.cs b/NzbDrone.Web/App_Start/MiniProfiler.cs index 40a877994..63375453a 100644 --- a/NzbDrone.Web/App_Start/MiniProfiler.cs +++ b/NzbDrone.Web/App_Start/MiniProfiler.cs @@ -1,23 +1,25 @@ +using System; using System.Web; using System.Web.Mvc; using System.Linq; -using MvcMiniProfiler; -using MvcMiniProfiler.MVCHelpers; +using StackExchange.Profiling; +using StackExchange.Profiling.MVCHelpers; +using Microsoft.Web.Infrastructure; using Microsoft.Web.Infrastructure.DynamicModuleHelper; -using NzbDrone.Common; -using NzbDrone.Web.Helpers; - //using System.Data; //using System.Data.Entity; //using System.Data.Entity.Infrastructure; +//using StackExchange.Profiling.Data.EntityFramework; +//using StackExchange.Profiling.Data.Linq2Sql; -//using MvcMiniProfiler.Data.Linq2Sql; +[assembly: WebActivator.PreApplicationStartMethod( + typeof(NzbDrone.Web.App_Start.MiniProfilerPackage), "PreStart")] -[assembly: WebActivator.PreApplicationStartMethod(typeof(NzbDrone.Web.App_Start.MiniProfilerPackage), "PreStart")] -[assembly: WebActivator.PostApplicationStartMethod(typeof(NzbDrone.Web.App_Start.MiniProfilerPackage), "PostStart")] +[assembly: WebActivator.PostApplicationStartMethod( + typeof(NzbDrone.Web.App_Start.MiniProfilerPackage), "PostStart")] -namespace NzbDrone.Web.App_Start +namespace NzbDrone.Web.App_Start { public static class MiniProfilerPackage { @@ -27,23 +29,37 @@ namespace NzbDrone.Web.App_Start // Be sure to restart you ASP.NET Developement server, this code will not run until you do that. //TODO: See - _MINIPROFILER UPDATED Layout.cshtml - // For profiling to display in the UI you will have to include the line @MvcMiniProfiler.MiniProfiler.RenderIncludes() + // For profiling to display in the UI you will have to include the line @StackExchange.Profiling.MiniProfiler.RenderIncludes() // in your master layout - //TODO: Non SQL Server based installs can use other formatters like: new MvcMiniProfiler.SqlFormatters.InlineFormatter() - MiniProfiler.Settings.SqlFormatter = new MvcMiniProfiler.SqlFormatters.SqlServerFormatter(); + //TODO: Non SQL Server based installs can use other formatters like: new StackExchange.Profiling.SqlFormatters.InlineFormatter() + MiniProfiler.Settings.SqlFormatter = new StackExchange.Profiling.SqlFormatters.SqlServerFormatter(); - //TODO: To profile a standard DbConnection: - // var profiled = new ProfiledDbConnection(cnn, MiniProfiler.Current); + //TODO: To profile a standard DbConnection: + // var profiled = new ProfiledDbConnection(cnn, MiniProfiler.Current); //TODO: If you are profiling EF code first try: - // MiniProfilerEF.Initialize(); + // MiniProfilerEF.Initialize(); //Make sure the MiniProfiler handles BeginRequest and EndRequest DynamicModuleUtility.RegisterModule(typeof(MiniProfilerStartupModule)); //Setup profiler for Controllers via a Global ActionFilter GlobalFilters.Filters.Add(new ProfilingActionFilter()); + + // You can use this to check if a request is allowed to view results + //MiniProfiler.Settings.Results_Authorize = (request) => + //{ + // you should implement this if you need to restrict visibility of profiling on a per request basis + // return !DisableProfilingResults; + //}; + + // the list of all sessions in the store is restricted by default, you must return true to alllow it + //MiniProfiler.Settings.Results_List_Authorize = (request) => + //{ + // you may implement this if you need to restrict visibility of profiling lists on a per request basis + //return true; // all requests are kosher + //}; } public static void PostStart() @@ -65,33 +81,28 @@ namespace NzbDrone.Web.App_Start { context.BeginRequest += (sender, e) => { - //var request = ((HttpApplication)sender).Request; + var request = ((HttpApplication)sender).Request; //TODO: By default only local requests are profiled, optionally you can set it up // so authenticated users are always profiled - //if (request.IsLocal) { MiniProfiler.Start(); } - - if (!EnvironmentProvider.IsProduction || ProfilerHelper.Enabled()) - { - var requestPath = ((HttpApplication)sender).Request.AppRelativeCurrentExecutionFilePath.ToLower(); - if (!requestPath.StartsWith("~/signalr") && !requestPath.EndsWith("notification/comet")) - { - MiniProfiler.Start(); - } - } + if (request.IsLocal) { MiniProfiler.Start(); } }; + // TODO: You can control who sees the profiling information /* context.AuthenticateRequest += (sender, e) => { if (!CurrentUserIsAllowedToSeeProfiler()) { - MvcMiniProfiler.MiniProfiler.Stop(discardResults: true); + StackExchange.Profiling.MiniProfiler.Stop(discardResults: true); } }; */ - context.EndRequest += (sender, e) => MiniProfiler.Stop(); + context.EndRequest += (sender, e) => + { + MiniProfiler.Stop(); + }; } public void Dispose() { } diff --git a/NzbDrone.Web/Controllers/HealthController.cs b/NzbDrone.Web/Controllers/HealthController.cs index d9f6eaeec..5ab512bfc 100644 --- a/NzbDrone.Web/Controllers/HealthController.cs +++ b/NzbDrone.Web/Controllers/HealthController.cs @@ -1,4 +1,5 @@ using System.Web.Mvc; +using StackExchange.Profiling; namespace NzbDrone.Web.Controllers { @@ -7,7 +8,7 @@ namespace NzbDrone.Web.Controllers [HttpGet] public JsonResult Index() { - MvcMiniProfiler.MiniProfiler.Stop(true); + MiniProfiler.Stop(true); return Json("OK", JsonRequestBehavior.AllowGet); } diff --git a/NzbDrone.Web/Controllers/NotificationController.cs b/NzbDrone.Web/Controllers/NotificationController.cs index ff48a1780..eeaa50a66 100644 --- a/NzbDrone.Web/Controllers/NotificationController.cs +++ b/NzbDrone.Web/Controllers/NotificationController.cs @@ -1,8 +1,8 @@ using System.Threading; using System.Web.Mvc; using System.Web.UI; -using MvcMiniProfiler; using NzbDrone.Core.Providers; +using StackExchange.Profiling; namespace NzbDrone.Web.Controllers { diff --git a/NzbDrone.Web/Controllers/SeriesController.cs b/NzbDrone.Web/Controllers/SeriesController.cs index b88cdf9a1..fda395008 100644 --- a/NzbDrone.Web/Controllers/SeriesController.cs +++ b/NzbDrone.Web/Controllers/SeriesController.cs @@ -4,7 +4,6 @@ using System.IO; using System.Linq; using System.Web.Mvc; using System.Web.Script.Serialization; -using MvcMiniProfiler; using NzbDrone.Common.Model; using NzbDrone.Core; using NzbDrone.Core.Helpers; @@ -14,6 +13,7 @@ using NzbDrone.Core.Providers; using NzbDrone.Core.Repository; using NzbDrone.Core.Repository.Quality; using NzbDrone.Web.Models; +using StackExchange.Profiling; namespace NzbDrone.Web.Controllers { diff --git a/NzbDrone.Web/NzbDrone.Web.csproj b/NzbDrone.Web/NzbDrone.Web.csproj index 95da07b1e..c251ce61a 100644 --- a/NzbDrone.Web/NzbDrone.Web.csproj +++ b/NzbDrone.Web/NzbDrone.Web.csproj @@ -68,8 +68,8 @@ True ..\packages\Microsoft.Web.Infrastructure.1.0.0.0\lib\net40\Microsoft.Web.Infrastructure.dll - - ..\packages\MiniProfiler.1.9\lib\net40\MvcMiniProfiler.dll + + ..\packages\MiniProfiler.2.0.2\lib\net40\MiniProfiler.dll False @@ -148,6 +148,7 @@ + @@ -220,7 +221,6 @@ - @@ -549,6 +549,9 @@ + + + 10.0 $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) diff --git a/NzbDrone.Web/Views/Shared/_Layout.cshtml b/NzbDrone.Web/Views/Shared/_Layout.cshtml index bb437a340..db4692234 100644 --- a/NzbDrone.Web/Views/Shared/_Layout.cshtml +++ b/NzbDrone.Web/Views/Shared/_Layout.cshtml @@ -1,70 +1,71 @@ - -@{ Layout = "~/Views/Shared/_ReferenceLayout.cshtml"; } -@using NzbDrone.Common -@using NzbDrone.Web.Helpers -@section HeaderContent -{ - @if (string.IsNullOrWhiteSpace(ViewBag.Title) || String.Equals(ViewBag.Title, "NzbDrone", StringComparison.InvariantCultureIgnoreCase)) - { - ViewBag.Title = "NzbDrone"; - } - else - { - ViewBag.Title = String.Format("{0} - NzbDrone", ViewBag.Title); - } - @ViewBag.Title - @if (!EnvironmentProvider.IsProduction || ProfilerHelper.Enabled()) - { - @MvcMiniProfiler.MiniProfiler.RenderIncludes() - } - @Html.IncludeCss("Grid.css") - @RenderSection("HeaderContent", required: false) -} -
- - -
- @RenderSection("ActionMenu", required: false) - @RenderBody() -
- -
-
- background notification -
-@section Scripts -{ - @RenderSection("Scripts", required: false) - @Html.IncludeScript("jquery.signalR.min.js") - - @if (EnvironmentProvider.IsProduction) - { - - } -} + +@{ Layout = "~/Views/Shared/_ReferenceLayout.cshtml"; } +@using NzbDrone.Common +@using NzbDrone.Web.Helpers +@using StackExchange.Profiling +@section HeaderContent +{ + @if (string.IsNullOrWhiteSpace(ViewBag.Title) || String.Equals(ViewBag.Title, "NzbDrone", StringComparison.InvariantCultureIgnoreCase)) + { + ViewBag.Title = "NzbDrone"; + } + else + { + ViewBag.Title = String.Format("{0} - NzbDrone", ViewBag.Title); + } + @ViewBag.Title + @if (!EnvironmentProvider.IsProduction || ProfilerHelper.Enabled()) + { + @MiniProfiler.RenderIncludes() + } + @Html.IncludeCss("Grid.css") + @RenderSection("HeaderContent", required: false) +} +
+ + +
+ @RenderSection("ActionMenu", required: false) + @RenderBody() +
+ +
+
+ background notification +
+@section Scripts +{ + @RenderSection("Scripts", required: false) + @Html.IncludeScript("jquery.signalR.min.js") + + @if (EnvironmentProvider.IsProduction) + { + + } +} diff --git a/NzbDrone.Web/packages.config b/NzbDrone.Web/packages.config index 94c12bf6e..325a983b0 100644 --- a/NzbDrone.Web/packages.config +++ b/NzbDrone.Web/packages.config @@ -15,8 +15,8 @@ - - + + diff --git a/packages/MiniProfiler.2.0.2/MiniProfiler.2.0.2.nupkg b/packages/MiniProfiler.2.0.2/MiniProfiler.2.0.2.nupkg new file mode 100644 index 000000000..44fe48012 Binary files /dev/null and b/packages/MiniProfiler.2.0.2/MiniProfiler.2.0.2.nupkg differ diff --git a/packages/MiniProfiler.2.0.2/lib/net40/MiniProfiler.dll b/packages/MiniProfiler.2.0.2/lib/net40/MiniProfiler.dll new file mode 100644 index 000000000..5b6dd0e58 Binary files /dev/null and b/packages/MiniProfiler.2.0.2/lib/net40/MiniProfiler.dll differ diff --git a/packages/MiniProfiler.2.0.2/lib/net40/MiniProfiler.pdb b/packages/MiniProfiler.2.0.2/lib/net40/MiniProfiler.pdb new file mode 100644 index 000000000..4d47a7f8e Binary files /dev/null and b/packages/MiniProfiler.2.0.2/lib/net40/MiniProfiler.pdb differ diff --git a/packages/MiniProfiler.2.0.2/lib/net40/MiniProfiler.xml b/packages/MiniProfiler.2.0.2/lib/net40/MiniProfiler.xml new file mode 100644 index 000000000..318c5bbe3 --- /dev/null +++ b/packages/MiniProfiler.2.0.2/lib/net40/MiniProfiler.xml @@ -0,0 +1,2248 @@ + + + + MiniProfiler + + + + + Understands how to store a to a MSSQL database. + + + + + Understands how to save MiniProfiler results to a MSSQL database, allowing more permanent storage and + querying of slow results. + + + + + Provides saving and loading s to a storage medium. + + + + + Returns a list of profile guids (optionally in a particular date range) + + + + + defaults to decending + + + + + Stores under its . + + The results of a profiling session. + + Should also ensure the profiler is stored as being unviewed by its profiling . + + + + + Returns a from storage based on , which should map to . + + + Should also update that the resulting profiler has been marked as viewed by its profiling . + + + + + Sets a particular profiler session so it is considered "unviewed" + + + + + Sets a particular profiler session to "viewed" + + + + + Returns a list of s that haven't been seen by . + + User identified by the current . + + + + Returns a new SqlServerDatabaseStorage object that will insert into the database identified by connectionString. + + + + + Saves 'profiler' to a database under its . + + + + + Returns the MiniProfiler identified by 'id' from the database or null when no MiniProfiler exists under that 'id'. + + + + + Sets a particular profiler session so it is considered "unviewed" + + + + + Sets a particular profiler session to "viewed" + + + + + Returns a list of s that haven't been seen by . + + User identified by the current . + + + + Implement a basic list search here + + + + + + + + + + Returns a DbConnection for your specific provider. + + + + + Returns a DbConnection already opened for execution. + + + + + Giving freshly selected collections, this method puts them in the correct + hierarchy under the 'result' MiniProfiler. + + + + + How we connect to the database used to save/load MiniProfiler results. + + + + + Creates needed tables. Run this once on your database. + + + Works in sql server and sqlite (with documented removals). + TODO: add indexes + + + + + Returns a new . + + + + + Stores to dbo.MiniProfilers under its ; + stores all child Timings and SqlTimings to their respective tables. + + + + + Saves parameter Timing to the dbo.MiniProfilerTimings table. + + + + + Saves parameter SqlTiming to the dbo.MiniProfilerSqlTimings table. + + + + + Saves any SqlTimingParameters used in the profiled SqlTiming to the dbo.MiniProfilerSqlTimingParameters table. + + + + + Loads the MiniProfiler identifed by 'id' from the database. + + + + + sets the session to unviewed + + + + + sets the session to viewed + + + + + Returns a list of s that haven't been seen by . + + User identified by the current . + + + + Returns a connection to Sql Server. + + + + + A full install of Sql Server can return multiple result sets in one query, allowing the use of . + However, Sql Server CE and Sqlite cannot do this, so inheritors for those providers can return false here. + + + + + Wrapper for a db provider factory to enable profiling + + + + + Every provider factory must have an Instance public field + + + + + Used for db provider apis internally + + + + + Allow to re-init the provider factory. + + + + + + + proxy + + + + + + + proxy + + + + + proxy + + + + + proxy + + + + + proxy + + + + + proxy + + + + + proxy + + + + + proxy + + + + + proxy + + + + + proxy + + + + + Dapper, a light weight object mapper for ADO.NET + + + + + Purge the query cache + + + + + Return a count of all the cached queries by dapper + + + + + + Return a list of all the queries cached by dapper + + + + + + + Deep diagnostics only: find any hash collisions in the cache + + + + + + Execute parameterized SQL + + Number of rows affected + + + + Return a list of dynamic objects, reader is closed after the call + + + + + Executes a query, returning the data typed as per T + + the dynamic param may seem a bit odd, but this works around a major usability issue in vs, if it is Object vs completion gets annoying. Eg type new [space] get new object + A sequence of data of the supplied type; if a basic type (int, string, etc) is queried then the data from the first column in assumed, otherwise an instance is + created per row, and a direct column-name===member-name mapping is assumed (case insensitive). + + + + + Execute a command that returns multiple result sets, and access each in turn + + + + + Return a typed list of objects, reader is closed after the call + + + + + Maps a query to objects + + The first type in the recordset + The second type in the recordset + The return type + + + + + + + The Field we should split and read the second object from (default: id) + Number of seconds before command execution timeout + Is it a stored proc or a batch? + + + + + Maps a query to objects + + + + + + + + + + + + The Field we should split and read the second object from (default: id) + Number of seconds before command execution timeout + + + + + + Perform a multi mapping query with 4 input parameters + + + + + + + + + + + + + + + + + + + + Perform a multi mapping query with 5 input parameters + + + + + + + + + + + + + + + + + + + + + Internal use only + + + + + + + Internal use only + + + + + Internal use only + + + + + Internal use only + + + + + Internal use only + + + + + + + + + + + Throws a data exception, only used internally + + + + + + + + Called if the query cache is purged via PurgeQueryCache + + + + + Implement this interface to pass an arbitrary db specific set of parameters to Dapper + + + + + Add all the parameters needed to the command just before it executes + + The raw command prior to execution + Information about the query + + + + This is a micro-cache; suitable when the number of terms is controllable (a few hundred, for example), + and strictly append-only; you cannot change existing values. All key matches are on **REFERENCE** + equality. The type is fully thread-safe. + + + + + Identity of a cached query in Dapper, used for extensability + + + + + Create an identity for use with DynamicParameters, internal use only + + + + + + + + + + + + + + The sql + + + + + The command type + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Compare 2 Identity objects + + + + + + + The grid reader provides interfaces for reading multiple result sets from a Dapper query + + + + + Read the next grid of results + + + + + Read multiple objects from a single recordset on the grid + + + + + + + + + + + Read multiple objects from a single recordset on the grid + + + + + + + + + + + + Read multiple objects from a single record set on the grid + + + + + + + + + + + + + Read multiple objects from a single record set on the grid + + + + + + + + + + + + + + Dispose the grid, closing and disposing both the underlying reader and command. + + + + + A bag of parameters that can be passed to the Dapper Query and Execute methods + + + + + construct a dynamic parameter bag + + + + + construct a dynamic parameter bag + + can be an anonymous type of a DynamicParameters bag + + + + Append a whole object full of params to the dynamic + EG: AddParams(new {A = 1, B = 2}) // will add property A and B to the dynamic + + + + + + Add a parameter to this dynamic parameter list + + + + + + + + + + Get the value of a parameter + + + + The value, note DBNull.Value is not returned, instead the value is returned as null + + + + This class represents a SQL string, it can be used if you need to denote your parameter is a Char vs VarChar vs nVarChar vs nChar + + + + + Create a new DbString + + + + + Add the parameter to the command... internal use only + + + + + + + Ansi vs Unicode + + + + + Fixed length + + + + + Length of the string -1 for max + + + + + The value of the string + + + + + Provides functionality to identify which user is profiling a request. + + + + + Returns a string to identify the user profiling the current 'request'. + + The current HttpRequest being profiled. + + + + Common extension methods to use only in this project + + + + + Answers true if this String is either null or empty. + + + + + Answers true if this String is neither null or empty. + + + + + Removes trailing / characters from a path and leaves just one + + + + + Removes any leading / characters from a path + + + + + Removes any leading / characters from a path + + + + + Serializes to a json string. + + + + + Provides a wrapper around a native DbDataAdapter, allowing a profiled Fill operation. + + + + + This static variable is simply used as a non-null placeholder in the MiniProfiler.ExecuteFinish method + + + + + Initializes a new instance of the class. + + The wrapped adapter. + The profiler instance or null to get the current instance. + + + + Adds a named "Table" to the specified and configures the schema to match that in the data source based on the specified . + + The to be filled with the schema from the data source. + One of the values. + + An array of objects that contain schema information returned from the data source. + + + + + Adds or updates rows in the to match those in the data source using the name, and creates a named "Table". + + A to fill with records and, if necessary, schema. + + The number of rows successfully added to or refreshed in the . This does not include rows affected by statements that do not return rows. + + + + + Gets the parameters set by the user when executing an SQL SELECT statement. + + + An array of objects that contains the parameters set by the user. + + + + + Calls the respective INSERT, UPDATE, or DELETE statements for each inserted, updated, or deleted row in the specified from a named "Table". + + The used to update the data source. + + The number of rows successfully updated from the . + + An attempt to execute an INSERT, UPDATE, or DELETE statement resulted in zero records affected. + + + + Indicates or specifies whether unmapped source tables or columns are passed with their source names in order to be filtered or to raise an error. + + One of the values. The default is Passthrough. + + The value set is not one of the values. + + + + Indicates or specifies whether missing source tables, columns, and their relationships are added to the dataset schema, ignored, or cause an error to be raised. + + One of the values. The default is Add. + + The value set is not one of the values. + + + + Indicates how a source table is mapped to a dataset table. + + A collection that provides the master mapping between the returned records and the . The default value is an empty collection. + + + + Gets or sets an SQL statement used to select records in the data source. + + An that is used during to select records from data source for placement in the data set. + + + + Gets or sets an SQL statement used to insert new records into the data source. + + An used during to insert records in the data source for new rows in the data set. + + + + Gets or sets an SQL statement used to update records in the data source. + + An used during to update records in the data source for modified rows in the data set. + + + + Gets or sets an SQL statement for deleting records from the data set. + + An used during to delete records in the data source for deleted rows in the data set. + + + + Profiles a single sql execution. + + + + Holds the maximum size that will be stored for byte[] parameters + + + + Creates a new SqlTiming to profile 'command'. + + + + + Obsolete - used for serialization. + + + + + Returns a snippet of the sql command and the duration. + + + + + Returns true if Ids match. + + + + + Returns hashcode of Id. + + + + + Called when command execution is finished to determine this SqlTiming's duration. + + + + + Called when database reader is closed, ending profiling for SqlTimings. + + + + + To help with display, put some space around sammiched commas + + + + + Unique identifier for this SqlTiming. + + + + + Category of sql statement executed. + + + + + The sql that was executed. + + + + + The command string with special formatting applied based on MiniProfiler.Settings.SqlFormatter + + + + + Roughly where in the calling code that this sql was executed. + + + + + Offset from main MiniProfiler start that this sql began. + + + + + How long this sql statement took to execute. + + + + + When executing readers, how long it took to come back initially from the database, + before all records are fetched and reader is closed. + + + + + Stores any parameter names and values used by the profiled DbCommand. + + + + + Id of the Timing this statement was executed in. + + + Needed for database deserialization. + + + + + The Timing step that this sql execution occurred in. + + + + + True when other identical sql statements have been executed during this MiniProfiler session. + + + + + Information about a DbParameter used in the sql statement profiled by SqlTiming. + + + + + Returns true if this has the same parent , and as . + + + + + Returns the XOR of certain properties. + + + + + Which SqlTiming this Parameter was executed with. + + + + + Parameter name, e.g. "@routeName" + + + + + The value submitted to the database. + + + + + System.Data.DbType, e.g. "String", "Bit" + + + + + How large the type is, e.g. for string, size could be 4000 + + + + + Formats any SQL query with inline parameters, optionally including the value type + + + + + Takes a SqlTiming and returns a formatted SQL string, for parameter replacement, etc. + + + + + Return SQL the way you want it to look on the in the trace. Usually used to format parameters + + + Formatted SQL + + + + Creates a new Inline SQL Formatter, optionally including the parameter type info in comments beside the replaced value + + whether to include a comment after the value, indicating the type, e.g. /* @myParam DbType.Int32 */ + + + + Formats the SQL in a generic frieldly format, including the parameter type information in a comment if it was specified in the InlineFormatter constructor + + The SqlTiming to format + A formatted SQL string + + + + Returns a string representation of the parameter's value, including the type + + The parameter to get a value for + + + + + HttpContext based profiler provider. This is the default provider to use in a web context. + The current profiler is associated with a HttpContext.Current ensuring that profilers are + specific to a individual HttpRequest. + + + + + BaseProfilerProvider. This providers some helper methods which provide access to + internals not otherwise available. + To use, override the , and + methods. + + + + + A provider used to create instances and maintain the current instance. + + + + + Starts a new MiniProfiler and sets it to be current. By the end of this method + should return the new MiniProfiler. + + + + + Ends the current profiling session, if one exists. + + + When true, clears the for this HttpContext, allowing profiling to + be prematurely stopped and discarded. Useful for when a specific route does not need to be profiled. + + + + + Returns the current MiniProfiler. This is used by . + + + + + + Starts a new MiniProfiler and sets it to be current. By the end of this method + should return the new MiniProfiler. + + + + + Stops the current MiniProfiler (if any is currently running). + should be called if is false + + If true, any current results will be thrown away and nothing saved + + + + Returns the current MiniProfiler. This is used by . + + + + + + Sets to be active (read to start profiling) + This should be called once a new MiniProfiler has been created. + + The profiler to set to active + If is null + + + + Stops the profiler and marks it as inactive. + + The profiler to stop + True if successful, false if Stop had previously been called on this profiler + If is null + + + + Calls to save the current + profiler using the current storage settings + + + + + + Public constructor. This also registers any UI routes needed to display results + + + + + Starts a new MiniProfiler and associates it with the current . + + + + + Ends the current profiling session, if one exists. + + + When true, clears the for this HttpContext, allowing profiling to + be prematurely stopped and discarded. Useful for when a specific route does not need to be profiled. + + + + + Makes sure 'profiler' has a Name, pulling it from route data or url. + + + + + Returns the current profiler + + + + + + Gets the currently running MiniProfiler for the current HttpContext; null if no MiniProfiler was ed. + + + + + WebRequestProfilerProvider specific configurations + + + + + Provides user identification for a given profiling request. + + + + + Understands how to route and respond to MiniProfiler UI urls. + + + + + Usually called internally, sometimes you may clear the routes during the apps lifecycle, if you do that call this to bring back mp + + + + + Returns this to handle . + + + + + Returns either includes' css/javascript or results' html. + + + + + Handles rendering static content files. + + + + + Handles rendering a previous MiniProfiler session, identified by its "?id=GUID" on the query. + + + + + Embedded resource contents keyed by filename. + + + + + Helper method that sets a proper 404 response code. + + + + + Try to keep everything static so we can easily be reused. + + + + + Oracle formatter for all your Oracle formatting needs + + + + + Does NOTHING, implement me! + + + + + Used to provide + + + + + This code needs to be inserted in the page before client timings work + + + + + You can wrap an html block with timing wrappers using this helper + + + + + This needs to be called at the begining of the layout for client side probe support, returns nothing if mini profiler is not enabled + + + + + To be used inline in razor pages - times a script be sure to call InitClientTimings first + + + + + To be used inline in razor pages - times a script be sure to call InitClientTimings first + + + + + To be used inline in razor pages - times a script be sure to call InitClientTimings first + + + + + This is a micro-cache; suitable when the number of terms is controllable (a few hundred, for example), + and strictly append-only; you cannot change existing values. All key matches are on **REFERENCE** + equality. The type is fully thread-safe. + + + + + A single MiniProfiler can be used to represent any number of steps/levels in a call-graph, via Step() + + Totally baller. + + + + A callback for ProfiledDbConnection and family + + + + + Called when a command starts executing + + + + + + + Called when a reader finishes executing + + + + + + + + Called when a reader is done iterating through the data + + + + + + Called when an error happens during execution of a command + + + + + + + + True if the profiler instance is active + + + + + Starts when this profiler is instantiated. Each step will use this Stopwatch's current ticks as + their starting time. + + + + + Creates and starts a new MiniProfiler for the root , filtering steps to . + + + + + Returns the 's and this profiler recorded. + + + + + Returns true if Ids match. + + + + + Returns hashcode of Id. + + + + + Obsolete - used for serialization. + + + + + Walks the hierarchy contained in this profiler, starting with , and returns each Timing found. + + + + + Returns milliseconds based on Stopwatch's Frequency. + + + + + Starts a new MiniProfiler based on the current . This new profiler can be accessed by + + + + + + Ends the current profiling session, if one exists. + + + When true, clears the for this HttpContext, allowing profiling to + be prematurely stopped and discarded. Useful for when a specific route does not need to be profiled. + + + + + Returns an that will time the code between its creation and disposal. Use this method when you + do not wish to include the StackExchange.Profiling namespace for the extension method. + + A descriptive name for the code that is encapsulated by the resulting IDisposable's lifetime. + This step's visibility level; allows filtering when is called. + + + + Returns the css and javascript includes needed to display the MiniProfiler results UI. + + Which side of the page the profiler popup button should be displayed on (defaults to left) + Whether to show trivial timings by default (defaults to false) + Whether to show time the time with children column by default (defaults to false) + The maximum number of trace popups to show before removing the oldest (defaults to 15) + when true, shows buttons to minimize and clear MiniProfiler results + Whether MiniProfiler should attempt to load its own version of jQuery, or rely on a version previously loaded on the page + Script and link elements normally; an empty string when there is no active profiling session. + + + + Renders the current to json. + + + + + Renders the parameter to json. + + + + + Deserializes the json string parameter to a . + + + + + Create a DEEP clone of this object + + + + + + Returns all currently open commands on this connection + + + + + Returns all results contained in all child steps. + + + + + Contains any sql statements that are executed, along with how many times those statements are executed. + + + + + Adds to the current . + + + + + Returns the number of sql statements of that were executed in all s. + + + + + Identifies this Profiler so it may be stored/cached. + + + + + A display name for this profiling session. + + + + + When this profiler was instantiated. + + + + + Where this profiler was run. + + + + + Allows filtering of steps based on what + the steps are created with. + + + + + The first that is created and started when this profiler is instantiated. + All other s will be children of this one. + + + + + A string identifying the user/client that is profiling this request. Set + with an -implementing class to provide a custom value. + + + If this is not set manually at some point, the implementation will be used; + by default, this will be the current request's ip address. + + + + + Returns true when this MiniProfiler has been viewed by the that recorded it. + + + Allows POSTs that result in a redirect to be profiled. implementation + will keep a list of all profilers that haven't been fetched down. + + + + + Timings collected from the client + + + + + For unit testing, returns the timer. + + + + + Milliseconds, to one decimal place, that this MiniProfiler ran. + + + + + Returns true when or any of its are . + + + + + Returns true when all child s are . + + + + + Any Timing step with a duration less than or equal to this will be hidden by default in the UI; defaults to 2.0 ms. + + + + + Ticks since this MiniProfiler was started. + + + + + Points to the currently executing Timing. + + + + + Gets the currently running MiniProfiler for the current HttpContext; null if no MiniProfiler was ed. + + + + + Contains information about queries executed during this profiling session. + + + + + Milliseconds, to one decimal place, that this MiniProfiler was executing sql. + + + + + Returns true when we have profiled queries. + + + + + Returns true when any child Timings have duplicate queries. + + + + + How many sql data readers were executed in all steps. + + + + + How many sql scalar queries were executed in all steps. + + + + + How many sql non-query statements were executed in all steps. + + + + + Various configuration properties. + + + + + Excludes the specified assembly from the stack trace output. + + The short name of the assembly. AssemblyName.Name + + + + Excludes the specified type from the stack trace output. + + The System.Type name to exclude + + + + Excludes the specified method name from the stack trace output. + + The name of the method + + + + Make sure we can at least store profiler results to the http runtime cache. + + + + + Assemblies to exclude from the stack trace report. + Add to this using the method. + + + + + Types to exclude from the stack trace report. + Add to this using the method. + + + + + Methods to exclude from the stack trace report. + Add to this using the method. + + + + + The maximum number of unviewed profiler sessions (set this low cause we don't want to blow up headers) + + + + + The max length of the stack string to report back; defaults to 120 chars. + + + + + Any Timing step with a duration less than or equal to this will be hidden by default in the UI; defaults to 2.0 ms. + + + + + Dictates if the "time with children" column is displayed by default, defaults to false. + For a per-page override you can use .RenderIncludes(showTimeWithChildren: true/false) + + + + + Dictates if trivial timings are displayed by default, defaults to false. + For a per-page override you can use .RenderIncludes(showTrivial: true/false) + + + + + Determines how many traces to show before removing the oldest; defaults to 15. + For a per-page override you can use .RenderIncludes(maxTracesToShow: 10) + + + + + Dictates on which side of the page the profiler popup button is displayed; defaults to left. + For a per-page override you can use .RenderIncludes(position: RenderPosition.Left/Right) + + + + + Determines if min-max, clear, etc are rendered; defaults to false. + For a per-page override you can use .RenderIncludes(showControls: true/false) + + + + + + By default, SqlTimings will grab a stack trace to help locate where queries are being executed. + When this setting is true, no stack trace will be collected, possibly improving profiler performance. + + + + + When is called, if the current request url contains any items in this property, + no profiler will be instantiated and no results will be displayed. + Default value is { "/content/", "/scripts/", "/favicon.ico" }. + + + + + The path under which ALL routes are registered in, defaults to the application root. For example, "~/myDirectory/" would yield + "/myDirectory/includes.js" rather than just "/mini-profiler-resources/includes.js" + Any setting here should be in APP RELATIVE FORM, e.g. "~/myDirectory/" + + + + + Maximum payload size for json responses in bytes defaults to 2097152 characters, which is equivalent to 4 MB of Unicode string data. + + + + + Understands how to save and load MiniProfilers. Used for caching between when + a profiling session ends and results can be fetched to the client, and for showing shared, full-page results. + + + The normal profiling session life-cycle is as follows: + 1) request begins + 2) profiler is started + 3) normal page/controller/request execution + 4) profiler is stopped + 5) profiler is cached with 's implementation of + 6) request ends + 7) page is displayed and profiling results are ajax-fetched down, pulling cached results from + 's implementation of + + + + + The formatter applied to the SQL being rendered (used only for UI) + + + + + Assembly version of this dank MiniProfiler. + + + + + The provider used to provider the current instance of a provider + This is also + + + + + A function that determines who can access the MiniProfiler results url and list url. It should return true when + the request client has access to results, false for a 401 to be returned. HttpRequest parameter is the current request and + + + The HttpRequest parameter that will be passed into this function should never be null. + + + + + Special authorization function that is called for the list results (listing all the profiling sessions), + we also test for results authorize always. This must be set and return true, to enable the listing feature. + + + + + Allows switching out stopwatches for unit testing. + + + + + Categorizes individual steps to allow filtering. + + + + + Default level given to Timings. + + + + + Useful when profiling many items in a loop, but you don't wish to always see this detail. + + + + + Dictates on which side of the page the profiler popup button is displayed; defaults to left. + + + + + Profiler popup button is displayed on the left. + + + + + Profiler popup button is displayed on the right. + + + + + Contains helper methods that ease working with null s. + + + + + Wraps in a call and executes it, returning its result. + + The current profiling session or null. + Method to execute and profile. + The step name used to label the profiler results. + + + + + Returns an that will time the code between its creation and disposal. + + The current profiling session or null. + A descriptive name for the code that is encapsulated by the resulting IDisposable's lifetime. + This step's visibility level; allows filtering when is called. + + + + Adds 's hierarchy to this profiler's current Timing step, + allowing other threads, remote calls, etc. to be profiled and joined into this profiling session. + + + + + Returns an html-encoded string with a text-representation of ; returns "" when profiler is null. + + The current profiling session or null. + + + + Wraps a database connection, allowing sql execution timings to be collected when a session is started. + + + + + This will be made private; use + + + + + This will be made private; use + + + + + Returns a new that wraps , + providing query execution profiling. If profiler is null, no profiling will occur. + + Your provider-specific flavor of connection, e.g. SqlConnection, OracleConnection + The currently started or null. + + + + The underlying, real database connection to your db provider. + + + + + The current profiler instance; could be null. + + + + + The raw connection this is wrapping + + + + + Times collected from the client + + + + + Returns null if there is not client timing stuff + + + + + + + Stores information about client perf + + + + + + + + + + List of client side timings + + + + + A client timing probe + + + + + + + + + + + + + + + + + + + + Formats SQL server queries with a DECLARE up top for parameter values + + + + + Formats the SQL in a SQL-Server friendly way, with DECLARE statements for the parameters up top. + + The SqlTiming to format + A formatted SQL string + + + + Gets part of a stack trace containing only methods we care about. + + + + + Gets the current formatted and filted stack trace. + + Space separated list of methods + + + + Identifies users based on ip address. + + + + + Returns the paramter HttpRequest's client ip address. + + + + + Categories of sql statements. + + + + + Unknown + + + + + DML statements that alter database state, e.g. INSERT, UPDATE + + + + + Statements that return a single record + + + + + Statements that iterate over a result set + + + + + You can wrap your view engines with this view to enable profiling on views and partial + + + + + Wrap your view engines with this to allow profiling + + + + + + Find a partial + + + + + Find a view + + + + + Find a partial + + + + + Contains helper code to time sql statements. + + + + + Returns a new SqlProfiler to be used in the 'profiler' session. + + + + + Tracks when 'command' is started. + + + + + Returns all currently open commands on this connection + + + + + Finishes profiling for 'command', recording durations. + + + + + Called when 'reader' finishes its iterations and is closed. + + + + + The profiling session this SqlProfiler is part of. + + + + + Helper methods that allow operation on SqlProfilers, regardless of their instantiation. + + + + + Tracks when 'command' is started. + + + + + Finishes profiling for 'command', recording durations. + + + + + Called when 'reader' finishes its iterations and is closed. + + + + + This filter can be applied globally to hook up automatic action profiling + + + + + Happens before the action starts running + + + + + Happens after the action executes + + + + + If the underlying command supports BindByName, this sets/clears the underlying + implementation accordingly. This is required to support OracleCommand from dapper-dot-net + + + + + An individual profiling step that can contain child steps. + + + + + Rebuilds all the parent timings on deserialization calls + + + + + Offset from parent MiniProfiler's creation that this Timing was created. + + + + + Creates a new Timing named 'name' in the 'profiler's session, with 'parent' as this Timing's immediate ancestor. + + + + + Obsolete - used for serialization. + + + + + Returns this Timing's Name. + + + + + Returns true if Ids match. + + + + + Returns hashcode of Id. + + + + + Adds arbitrary string 'value' under 'key', allowing custom properties to be stored in this Timing step. + + + + + Completes this Timing's duration and sets the MiniProfiler's Head up one level. + + + + + Add the parameter 'timing' to this Timing's Children collection. + + + Used outside this assembly for custom deserialization when creating an implementation. + + + + + Adds the parameter 'sqlTiming' to this Timing's SqlTimings collection. + + A sql statement profiling that was executed in this Timing step. + + Used outside this assembly for custom deserialization when creating an implementation. + + + + + Returns the number of sql statements of that were executed in this . + + + + + Unique identifer for this timing; set during construction. + + + + + Text displayed when this Timing is rendered. + + + + + How long this Timing step took in ms; includes any Timings' durations. + + + + + The offset from the start of profiling. + + + + + All sub-steps that occur within this Timing step. Add new children through + + + + + Stores arbitrary key/value strings on this Timing step. Add new tuples through . + + + + + Any queries that occurred during this Timing step. + + + + + Needed for database deserialization and JSON serialization. + + + + + Which Timing this Timing is under - the duration that this step takes will be added to its parent's duration. + + This will be null for the root (initial) Timing. + + + + Gets the elapsed milliseconds in this step without any children's durations. + + + + + Gets the aggregate elapsed milliseconds of all SqlTimings executed in this Timing, excluding Children Timings. + + + + + Returns true when this is less than the configured + , by default 2.0 ms. + + + + + Reference to the containing profiler, allowing this Timing to affect the Head and get Stopwatch readings. + + + + + Returns true when this Timing has inner Timing steps. + + + + + Returns true if this Timing step collected sql execution timings. + + + + + Returns true if any s executed in this step are detected as duplicate statements. + + + + + Returns true when this Timing is the first one created in a MiniProfiler session. + + + + + How far away this Timing is from the Profiler's Root. + + + + + How many sql data readers were executed in this Timing step. Does not include queries in any child Timings. + + + + + How many sql scalar queries were executed in this Timing step. Does not include queries in any child Timings. + + + + + How many sql non-query statements were executed in this Timing step. Does not include queries in any child Timings. + + + + + Understands how to store a to the with absolute expiration. + + + + + The string that prefixes all keys that MiniProfilers are saved under, e.g. + "mini-profiler-ecfb0050-7ce8-4bf1-bf82-2cb38e90e31e". + + + + + Returns a new HttpRuntimeCacheStorage class that will cache MiniProfilers for the specified duration. + + + + + Saves to the HttpRuntime.Cache under a key concated with + and the parameter's . + + + + + remembers we did not view the profile + + + + + Set the profile to viewed for this user + + + + + Returns the saved identified by . Also marks the resulting + profiler to true. + + + + + Returns a list of s that haven't been seen by . + + User identified by the current . + + + + Syncs access to runtime cache when adding a new list of ids for a user. + + + + + How long to cache each for (i.e. the absolute expiration parameter of + ) + + + + diff --git a/packages/MiniProfiler.MVC3.1.9.1/MiniProfiler.MVC3.1.9.1.nupkg b/packages/MiniProfiler.MVC3.1.9.1/MiniProfiler.MVC3.1.9.1.nupkg deleted file mode 100644 index 2f24b1c0c..000000000 Binary files a/packages/MiniProfiler.MVC3.1.9.1/MiniProfiler.MVC3.1.9.1.nupkg and /dev/null differ diff --git a/packages/MiniProfiler.MVC3.1.9.1/Content/App_Start/MiniProfiler.cs.pp b/packages/MiniProfiler.MVC3.2.0.2/Content/App_Start/MiniProfiler.cs.pp similarity index 69% rename from packages/MiniProfiler.MVC3.1.9.1/Content/App_Start/MiniProfiler.cs.pp rename to packages/MiniProfiler.MVC3.2.0.2/Content/App_Start/MiniProfiler.cs.pp index fba149a11..8a7171dbd 100644 --- a/packages/MiniProfiler.MVC3.1.9.1/Content/App_Start/MiniProfiler.cs.pp +++ b/packages/MiniProfiler.MVC3.2.0.2/Content/App_Start/MiniProfiler.cs.pp @@ -2,15 +2,15 @@ using System.Web; using System.Web.Mvc; using System.Linq; -using MvcMiniProfiler; -using MvcMiniProfiler.MVCHelpers; +using StackExchange.Profiling; +using StackExchange.Profiling.MVCHelpers; using Microsoft.Web.Infrastructure; using Microsoft.Web.Infrastructure.DynamicModuleHelper; //using System.Data; //using System.Data.Entity; //using System.Data.Entity.Infrastructure; -//using MvcMiniProfiler.Data.EntityFramework; -//using MvcMiniProfiler.Data.Linq2Sql; +//using StackExchange.Profiling.Data.EntityFramework; +//using StackExchange.Profiling.Data.Linq2Sql; [assembly: WebActivator.PreApplicationStartMethod( typeof($rootnamespace$.App_Start.MiniProfilerPackage), "PreStart")] @@ -29,11 +29,11 @@ namespace $rootnamespace$.App_Start // Be sure to restart you ASP.NET Developement server, this code will not run until you do that. //TODO: See - _MINIPROFILER UPDATED Layout.cshtml - // For profiling to display in the UI you will have to include the line @MvcMiniProfiler.MiniProfiler.RenderIncludes() + // For profiling to display in the UI you will have to include the line @StackExchange.Profiling.MiniProfiler.RenderIncludes() // in your master layout - //TODO: Non SQL Server based installs can use other formatters like: new MvcMiniProfiler.SqlFormatters.InlineFormatter() - MiniProfiler.Settings.SqlFormatter = new MvcMiniProfiler.SqlFormatters.SqlServerFormatter(); + //TODO: Non SQL Server based installs can use other formatters like: new StackExchange.Profiling.SqlFormatters.InlineFormatter() + MiniProfiler.Settings.SqlFormatter = new StackExchange.Profiling.SqlFormatters.SqlServerFormatter(); //TODO: To profile a standard DbConnection: // var profiled = new ProfiledDbConnection(cnn, MiniProfiler.Current); @@ -46,6 +46,20 @@ namespace $rootnamespace$.App_Start //Setup profiler for Controllers via a Global ActionFilter GlobalFilters.Filters.Add(new ProfilingActionFilter()); + + // You can use this to check if a request is allowed to view results + //MiniProfiler.Settings.Results_Authorize = (request) => + //{ + // you should implement this if you need to restrict visibility of profiling on a per request basis + // return !DisableProfilingResults; + //}; + + // the list of all sessions in the store is restricted by default, you must return true to alllow it + //MiniProfiler.Settings.Results_List_Authorize = (request) => + //{ + // you may implement this if you need to restrict visibility of profiling lists on a per request basis + //return true; // all requests are kosher + //}; } public static void PostStart() @@ -80,7 +94,7 @@ namespace $rootnamespace$.App_Start { if (!CurrentUserIsAllowedToSeeProfiler()) { - MvcMiniProfiler.MiniProfiler.Stop(discardResults: true); + StackExchange.Profiling.MiniProfiler.Stop(discardResults: true); } }; */ diff --git a/packages/MiniProfiler.MVC3.1.9.1/Content/Views/Shared/_MINIPROFILER UPDATED Layout.cshtml b/packages/MiniProfiler.MVC3.2.0.2/Content/Views/Shared/_MINIPROFILER UPDATED Layout.cshtml similarity index 53% rename from packages/MiniProfiler.MVC3.1.9.1/Content/Views/Shared/_MINIPROFILER UPDATED Layout.cshtml rename to packages/MiniProfiler.MVC3.2.0.2/Content/Views/Shared/_MINIPROFILER UPDATED Layout.cshtml index a94c78909..87b393155 100644 --- a/packages/MiniProfiler.MVC3.1.9.1/Content/Views/Shared/_MINIPROFILER UPDATED Layout.cshtml +++ b/packages/MiniProfiler.MVC3.2.0.2/Content/Views/Shared/_MINIPROFILER UPDATED Layout.cshtml @@ -1,16 +1,20 @@ - +@* Required so you have extention methods for client timings *@ +@using StackExchange.Profiling; + + @* optional (enable client timing framework) *@ + @this.InitClientTimings() @ViewBag.Title - - - - - @* Make sure you've added this one line to your LAYOUT or MASTER PAGE *@ - - @MvcMiniProfiler.MiniProfiler.RenderIncludes() - + + @* optional time scripts in the header *@ + @this.TimeScript("Content Site.css", + @) + @this.TimeScript("jQuery 1.5.1", + @) + @this.TimeScript("modernizr", + @) @@ -35,5 +39,7 @@ + @* Make sure you've added this one line to your LAYOUT or MASTER PAGE *@ + @MiniProfiler.RenderIncludes() diff --git a/packages/MiniProfiler.MVC3.2.0.2/MiniProfiler.MVC3.2.0.2.nupkg b/packages/MiniProfiler.MVC3.2.0.2/MiniProfiler.MVC3.2.0.2.nupkg new file mode 100644 index 000000000..f727fb9b6 Binary files /dev/null and b/packages/MiniProfiler.MVC3.2.0.2/MiniProfiler.MVC3.2.0.2.nupkg differ diff --git a/packages/MiniProfiler.MVC3.1.9.1/tools/install.ps1 b/packages/MiniProfiler.MVC3.2.0.2/tools/install.ps1 similarity index 100% rename from packages/MiniProfiler.MVC3.1.9.1/tools/install.ps1 rename to packages/MiniProfiler.MVC3.2.0.2/tools/install.ps1