How to: Profile JavaScript (ECMA) Code in Web Pages

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.

Requirements

  • Visual Studio Ultimate, Visual Studio Premium, Visual Studio Professional

  • Internet Explorer 8 or later.

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. In Visual Studio Premium, open the ASP.NET Web project.

  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 Premium.

  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.