Skip to content

Commit

Permalink
Updated MiniProfiler package to latest version
Browse files Browse the repository at this point in the history
  • Loading branch information
muratcakir committed Oct 28, 2014
1 parent e020354 commit d0cbe88
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/Plugins/SmartStore.DevTools/DependencyRegistrar.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public virtual void Register(ContainerBuilder builder, ITypeFinder typeFinder, b
if (isActiveModule)
{
// intercept ALL public store controller actions
builder.RegisterType<ProfilerFilter>().AsActionFilterFor<PublicControllerBase>();
builder.RegisterType<ProfilerFilter>().AsActionFilterFor<SmartController>();

//// intercept CatalogController's Product action
//builder.RegisterType<SampleResultFilter>().AsResultFilterFor<CatalogController>(x => x.Product(default(int), default(string))).InstancePerRequest();
Expand Down
16 changes: 12 additions & 4 deletions src/Plugins/SmartStore.DevTools/Filters/ProfilerFilter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public void OnActionExecuting(ActionExecutingContext filterContext)
string.Empty;
string controller = string.Concat(filterContext.Controller.ToString().Split('.').Last(), ".");
string action = filterContext.ActionDescriptor.ActionName;
this._profiler.Value.StepStart("ActionFilter", "Controller: " + area + controller + action);
this._profiler.Value.StepStart("ActionFilter", "Action: " + area + controller + action);
}

public void OnActionExecuted(ActionExecutedContext filterContext)
Expand All @@ -63,7 +63,8 @@ public void OnResultExecuting(ResultExecutingContext filterContext)
return;

// should only run on a full view rendering result
if (!(filterContext.Result is ViewResultBase))
var result = filterContext.Result as ViewResultBase;
if (result == null)
{
return;
}
Expand All @@ -79,10 +80,17 @@ public void OnResultExecuting(ResultExecutingContext filterContext)
"head_html_tag",
"MiniProfiler",
"DevTools",
new { Namespaces = "SmartStore.DevTools.Controllers", area = "SmartStore.DevTools" });
new { area = "SmartStore.DevTools" });
}

var viewName = result.ViewName;
if (viewName.IsEmpty())
{
string action = (filterContext.RouteData.Values["action"] as string).EmptyNull();
viewName = action;
}

this._profiler.Value.StepStart("ResultFilter", string.Format("Result: {0}", filterContext.Result));
this._profiler.Value.StepStart("ResultFilter", string.Format("{0}: {1}", result is PartialViewResult ? "Partial" : "View", viewName));
}

public void OnResultExecuted(ResultExecutedContext filterContext)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ namespace SmartStore.DevTools.Services
{
public interface IProfilerService
{
void StepStart(string key, string message, bool isVerbose = false);
void StepStart(string key, string message);
void StepStop(string key);
}
}
4 changes: 2 additions & 2 deletions src/Plugins/SmartStore.DevTools/Services/ProfilerService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@ protected MiniProfiler Profiler
}
}

public void StepStart(string key, string message, bool isVerbose = false)
public void StepStart(string key, string message)
{
if (this.Profiler == null)
{
return;
}

var stack = this.steps.GetOrAdd(key, k => new ConcurrentStack<IDisposable>());
var step = this.Profiler.Step(message, isVerbose ? ProfileLevel.Verbose : ProfileLevel.Info);
var step = this.Profiler.Step(message);
stack.Push(step);
}

Expand Down
5 changes: 3 additions & 2 deletions src/Plugins/SmartStore.DevTools/SmartStore.DevTools.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,9 @@
<Reference Include="Microsoft.Web.Infrastructure, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\..\packages\Microsoft.Web.Infrastructure.1.0.0.0\lib\net40\Microsoft.Web.Infrastructure.dll</HintPath>
</Reference>
<Reference Include="MiniProfiler">
<HintPath>..\..\packages\MiniProfiler.2.1.0\lib\net40\MiniProfiler.dll</HintPath>
<Reference Include="MiniProfiler, Version=3.1.1.140, Culture=neutral, PublicKeyToken=b44f9351044011a3, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\packages\MiniProfiler.3.1.1.140\lib\net40\MiniProfiler.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System" />
Expand Down
2 changes: 1 addition & 1 deletion src/Plugins/SmartStore.DevTools/packages.config
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@
<package id="Microsoft.AspNet.Razor" version="3.2.2" targetFramework="net45" />
<package id="Microsoft.AspNet.WebPages" version="3.2.2" targetFramework="net45" />
<package id="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net45" />
<package id="MiniProfiler" version="2.1.0" targetFramework="net45" />
<package id="MiniProfiler" version="3.1.1.140" targetFramework="net45" />
</packages>

0 comments on commit d0cbe88

Please sign in to comment.