How to do Code and Performance Analysis using Visual Studio
set of tools for code and performance analysis is essential for the developers
if they need to develop reliable and robust software. These tools should be capable
of detecting the errors and the defects in the coding and the performance errors
so that they are corrected at an earlier stage in the development.
This is essential to reduce the overall cost of developing that application. In the earlier versions of the Visual Studio there were no Analysis tools available. Hence the developers have to depend on the third party tools or create their own custom analysis tools or ship the code without analysis.
This is overcome in the latest version of the Visual Studio Team System. With the integration of the Analysis Tools in the Visual Studio environment it is possible to work efficiently in building the application.
The analysis tools in the Visual Studio 2005 Team System can be categorized into two types. They are the Code Analysis Tools and the Performance Analysis Tools. These tools are integrated in the Visual Studio environment itself. If needed, you can also use these tools from the command line.
Studio 2005 Team System has two tools for code analysis. They are PREfast and
FxCop. PREfast is a tool that is used for static analysis. It analysis the code
(C/C++) and gives you the defects that are likely to appear in the code.
#pragma warning (error: 6260)
The code to ignore or disable warning is,
#pragma warning (disable: 6011)
This tool also supports annotation where you can get the information on conditions before function parameter is used and after a function parameter is used. You can also get information on return types. You can also use the PREfast tool in the command line.
tool FxCop is used to analyze the code for the violation in design rules and programming.
It also gives you information on the assemblies. The violation of the design and
programming rules are compared to the rules given in the Design Guidelines of
Microsoft .Net Framework.
can select the configuration properties and then select the Rules option to enable
the different types of Rules. You can select Rules like ComRules, NamingRules,
and SecurityRules using the checkboxes available for that purpose.
Performance related problems in the code are identified using the Performance
Tools available in the Visual Studio 2005 Team System. These tools allow you to
measure and evaluate the issues related to performance. Two types of profiling
are done with these performance tools.
the Performance Session Wizard available in Visual Studio 2005 Team System you
can create profiling for the applications. You can begin with sampling and then
based on the results of sampling you can use instrumentation for a specific portion
of the application.
types of views are available for viewing the reports. Summary, Functions, Caller/Callee,
CallStack and Type are the views that are available for the reports. The Summary
view is used as the starting point of the analysis.
more information on the tools used for the code analysis and performance analysis
you can always refer to the MSDN website. Its no wonder that these tools
are used for building reliable and robust applications.