🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

StopWatch

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

StopWatch

This simple filter allows you to time all your action methods. See the ReadMe.txt file for details. See http://blogs.msdn.com/b/webdev/archive/2014/07/29/profile-and-time-your-asp-net-mvc-app-all-the-way-to-azure.aspx for details.

1.0.6
NuGet
Version published
Maintainers
1
Created
Source

See http://blogs.msdn.com/b/webdev/archive/2014/07/29/profile-and-time-your-asp-net-mvc-app-all-the-way-to-azure.aspx for more info.

To register this filter you need to add the following line to the App_Start\FilterConfig.cs file:

filters.Add(new UseStopwatchAttribute());

For Example:

 public class FilterConfig
{
    public static void RegisterGlobalFilters(GlobalFilterCollection filters)
    {
        filters.Add(new HandleErrorAttribute());
        filters.Add(new UseStopwatchAttribute());  // Add this line
    }
}

Alternatively, to get the timings on specific controllers, add the [UseStopwatch] attribute to the controller. For example:

[UseStopwatch] public class HomeController : Controller

  <add key="TraceErrorTime" value="2.5" />
  <add key="TraceWarningTime" value=".5" />
  <add key="TraceInformationTime" value=".25" />
  <add key="SkipTimeInLayout" value="1" />

To see the time in each page, add the following code to the Views\Shared_Layout.cshtml file:

@Html.Encode(ViewBag.elapsedTime)

Keywords

AspNetMVC

FAQs

Package last updated on 27 Aug 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts