The Team Edition for Developers (TED) product suite is a collection of software-development tools from the Microsoft Team System suite of products. In my last column "Can I Call You TED?" (http://www.windowsitpro.com/sqlserver/article/articleid/46765/46765.html), I introduced you to TED's Static Code Analysis tool. This week I want to discuss TED's Profiling and Dynamic Code Analysis tool, then take a quick look at the Class Designer, which is common to all of the Team Edition products.
The Profiling and Dynamic Code Analysis tool lets you look at the runtime behavior of an application. Unlike static code analysis, which tends to focus on source code and best coding practices, dynamic code analysis focuses on an application's use of system resources. That application might be a class library, an executable, or even an ASP.NET-based Web site. The Profiling and Dynamic Code Analysis tool lets you see your application's memory usage and other runtime characteristics so that you can manage the application's performance. Thus, in Visual Studio 2005 beta 2, you'll find the Profiling and Dynamic Code Analysis tool on the Tools menu under Performance.
You can use the Performance tool to gain insight into the runtime environment for your managed code. However, there's a slight problem with the tool in the beta 2 version. If you're running Visual Studio 2005 beta 2 on Microsoft Virtual PC, you can start the performance wizard and set up a new performance project for your application but when you attempt to launch a test, you suddenly hit a wall. Specifically, you get an error message that says the tool won't work on Virtual PC. If you have Visual Studio 2005 Beta 2 installed on a physical machine or even a VMware machine, you won't receive that error message and you can, in fact, run the Performance tool.
Running the Performance tool opens an additional tab in Visual Studio 2005 that's typically on the left side of the display in the same region as the Toolbox and Server Explorer. This is Performance Explorer, and it lets you group one or more performance projects under your solution. You can launch each performance project independently and gather the material you need. That material is then available from the Reports section of that project.
When you start working with the performance monitors, you'll find two modes: Sampling and Instrumentation. Sampling mode basically monitors your application like a black box monitors an airplane. Sampling mode monitors the application's overall impact on the system but doesn't provide any insight into the details of why or how your application is using resources.
Instrumentation mode is more akin to white-box testing. With this mode, the performance engine will insert monitoring calls around the events you have ask it to monitor. You can capture very detailed runtime information and see exactly how your application is consuming resources. Setting the necessary flags to properly gather performance instrumentation information is beyond the scope of what I can cover in this column, but suffice it to say you can retrieve everything. If you aren't careful, you can capture so much information that the file becomes almost unmanageable.
In terms of the current documentation, an overview of the Performance tool is located on the Microsoft Developer Network (MSDN) Beta Library at http://msdn2.microsoft.com/library/84zheddz(en-us,vs.80).aspx. In addition, like for the Static Code Analysis tool, there are walkthroughs being created. Although the ASP.NET walkthrough is a little sparse, the application walkthrough is helpful. You can access that walkthrough at http://msdn2.microsoft.com/library/ms182398(en-us,vs.80).aspx. Some of the best documentation I've found related to the Performance tool is linked from the Enterprise Performance Tools Team Web page at http://blogs.msdn.com/profiler. Another good place for additional profiling links is IanWho's Blog at http://blogs.msdn.com/ianhu/default.aspx.
Now let's take a quick look at the Class Designer, a tool designed to help you visualize architect classes and understand their relationships. As I mentioned previously, the Class Designer is common to every Team Edition. It's truly integrated into your project. To leverage the Class Designer, you need to add a new class diagram to your project. You add this diagram in exactly the same manner that you would add a new class to your project while in Solution Explorer.
The class diagram behaves like any other source file in your project, but it's a special source file. Similar to a graphic element such as a Windows Form or User Control, double-clicking Class Diagram opens a graphic workspace. However, the class diagram has its own toolbox, which contains the tools to create a graphical representation of the classes in your project. More important, after you've placed one or more classes onto your diagram, you can have Visual Studio 2005 automatically generate the source files (including method and property stubs) based on your diagram.
A word of warning: If you create a new class diagram in your existing class library, you don't want to start dragging new classes from the toolbox onto your drawing. Instead, grab the existing classes from Solution Explorer and drag them onto your design surface. The Class Designer was created to provide an accurate picture of your existing classes as well as help you create new classes. It makes sense to have this tool embedded with your source files in a project because it becomes tied to these classes. The key is that although the Class Designer lets you to design classes at the start of a project, which is helpful, its true value lies in the fact that it stays in sync with changes you make to your classes and hierarchy.
The Class Designer isn't just a design tool; it also provides a real-time look at the actual implementation of your project. For a more complete overview of the Class Designer, go to http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dv_vstechart/html/clssdsgnr.asp.