다음을 통해 공유


How to: Profile JavaScript code in web pages

Applies to: yesVisual Studio noVisual Studio for Mac

Note

This article applies to Visual Studio 2017. If you're looking for the latest Visual Studio documentation, see Visual Studio documentation. We recommend upgrading to the latest version of Visual Studio. Download it here

Visual Studio Profiling Tools can collect performance data for JavaScript code that executes in an ASP.NET web application, an arbitrary web page, or JavaScript application by using the instrumentation profiling method. Requires Internet Explorer 8 or later.

Warning

To profile JavaScript in UWP apps, see JavaScript Memory

You can use the Profiling Wizard to create a performance session. Specify the instrumentation method and then specify the JavaScript profiling option on the Instrumentation page of the properties dialog box for the performance session.

When you specify JavaScript profiling, both the JavaScript code that executes in the browser and the ASP.NET code that executes on the server are profiled.

  • For an ASP.NET web application, both the JavaScript code that executes in the browser and the ASP.NET code that executes on the server are profiled.

  • For an arbitrary web page, the JavaScript code that executes in the browser is profiled.

To profile JavaScript in an ASP.NET web application project

  1. Open the ASP.NET web project in Visual Studio.

  2. On the Analyze menu, click Launch Performance Wizard.

  3. On the first page of the Performance Wizard, specify the Instrumentation profiling method, and then click Next.

  4. On the second page of the wizard, make sure that the current project is selected in the list of targets, and then click Next.

  5. On the third page of the wizard, select the Profile JavaScript check box, and then click Next.

  6. On the fourth page of the wizard, click Finish to start the web application in the browser.

  7. Exercise the functionality that you want to profile.

  8. To end the profiling session, close the browser.

To profile JavaScript in individual web pages or a JavaScript applications

  1. Open Visual Studio.

  2. On the Analyze menu, click Launch Performance Wizard.

  3. On the first page of the Performance Wizard, specify the Instrumentation profiling method, and then click Next.

  4. On the second page of the wizard, click An ASP.NET or JavaScript application, and then click Next.

  5. On the third page of the wizard:

    1. Type the URL of the page in the What URL or path will run your application box.

    2. Select the Profile JavaScript check box, and then click Next.

  6. On the fourth page of the wizard, click Finish to start the web page in the browser.

  7. Exercise the functionality that you want to profile.

  8. To end the profiling session, close the browser.