Global Bank: Coding the New Service, Part 2

Visual Studio Team System 2008 now supports comparing performance session reports to show the differences, performance regressions, and improvements that occurred from one profiling session to another. This is the fourth in a series of articles that will describe a common development scenario at the fictitious Global Bank and show how you can use Visual Studio Team System for your next project. If you're new to the series, you can meet the Global Bank team by reading the introductory article Global Bank: A Scenario for Visual Studio Team System 2008.

Scenario

Earlier, Martin wrote the code to implement CDService. He then used the code analysis and code metrics tools to fine-tune his code. Martin also ran the debugger to identify issues in his code. For details, read Global Bank: Coding the New Service, Part 1.

Unit Testing

Martin now needs to create a unit test to check his code. He uses the Unit Test Wizard to automatically create a test project, named CDServiceTestProject. The wizard also generates a test class with some pre-populated methods. Martin edits the test class and runs the unit test. After the unit test passes, Martin temporarily changes a section of code and runs the unit test again to force a failure.

Checking Performance

Now that Martin is confident that his code works, he wants to check for possible performance issues. He uses the Launch Performance Wizard command on the Analyze menu to create a new profiling session. In the Performance Wizard, Martin chooses to use Instrumentation as the profiling method.

In Performance Explorer, he clicks the Launch with Profiling button. Visual Studio builds the project and starts to profile the application. Martin interacts with the Web service, performing common tasks that customers might do. He then closes the Web service. Martin reviews the Performance Report Summary, with the goal of identifying operations that took more time to complete than others in his code.

Figure 1: Performance Report Summary

Global Bank Performance Report Summary

Martin switches the Performance Report to Call Tree view and then uses the Expand Hot Path on <area> feature on the shortcut menu to investigate further. He identifies an operation that needs adjustments, and then optimizes the code to fix the issue. He then saves the performance session.

After the fixes are saved, Martin launches another profiling session to verify that his changes improved performance and to check for additional performance issues. He uses the Compare Performance Reports command on the Analyze menu to view the change in performance between profiling sessions.

Figure 2: Performance Comparison Report

Bb986743.45fbcc62-dcc2-44b2-aab3-3824bf80392c(en-us,VS.90).png

He then saves the performance session, named CDService.psess, to his local drive for future reference. Martin checks in his changes. He e-mails Ellen to let her know that she can begin testing the updates that he made to the Global Bank Web site.

Further Reading from MSDN Online

How to: Generate a Unit Test

Analyzing Application Performance Using Profiling Tools

How to: Use Performance Wizard

Profiling Tools Report Overview

Profiling Tools Report Views

Comparing Profiler Report Files

What's New in Development Edition