Visual Studio 2010 x64 code coverage

The internal code coverage tool I was talking about in my previous post has been shipped with Visual Studio 2010. The full path to it is \Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Performance Tools\x64 for the 64 bit code coverage. 1 layer up the folder is for the x86 code coverage. The commands are the same as in my previous post but you need to install the highlighted component to get the x64 folder to appear.

 

 

Reference: VsPerfCmd

Steps of how to collect code coverage data of WCF and Windows Service

1. Stop all the services or processes of instrumented binary files (e,g, WstJobFrameworkAgent, WstJobFrameworkManager service)

2. Run the command to start code coverage monitor. Change C:\183.coverage to a different filename for the to be saved code coverage file.

C:\Users\hiliao> "C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Performance Tools\x64\VSPerfCmd.exe" /start:coverage /output:C:\183.coverage /cs /user:Everyone

Microsoft (R) VSPerf Command Version 10.0.30319 x64

Copyright (C) Microsoft Corp. All rights reserved.

3. Start the service stopped at step 1. Run BVT test. BVT starts hitting WCF and consuming the services

4. Run the command to check if code coverage is running

C:\Users\hiliao> "C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Performance Tools\x64\VSPerfCmd.exe" /status

Microsoft (R) VSPerf Command Version 10.0.30319 x64

Copyright (C) Microsoft Corp. All rights reserved.

Process and Thread Status

============================================================

Output File Name : C:\183.coverage

Collection mode : COVERAGE

Maximum Processes : 64

Maximum Threads : 512

Number of Buffers : 514

Size of Buffers : 65536

============================================================

Maximum Number of Processes : 64

Number of Active Processes : 3

Global Start/Stop Count : 1

Global Suspend/Resume Count : 0

------------------------------------------------------------

 Process : D:\Program Files\Microsoft Webstore\WstJobFrameworkAgent.exe

 Process ID : 6288

 Num Threads : 0

 Start/Stop Count : 1

 Suspend/Resume Count : 0

------------------------------------------------------------

 Process : c:\windows\system32\inetsrv\w3wp.exe

 Process ID : 6592

 Num Threads : 0

 Start/Stop Count : 1

 Suspend/Resume Count : 0

------------------------------------------------------------

 Process : c:\windows\system32\inetsrv\w3wp.exe

 Process ID : 4252

 Num Threads : 0

 Start/Stop Count : 1

 Suspend/Resume Count : 0

============================================================

Users with access rights to monitor:

UserName (SID)

\Everyone (S-1-1-0)

BUILTIN\Administrators (S-1-5-32-544)

NT AUTHORITY\SYSTEM (S-1-5-18)

5. Look for the turquoise color indicating that BVT is hitting the WCF and webstore service

6. Wait for the BVT test to complete

7. Stop the services and processes started before. In case of WCF, stop IIS.

8. Run the command to shut down the code coverage monitor. If you did not stop the service or process, you will see the following waiting messages.

C:\Users\hiliao> "C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\

Performance Tools\x64\VSPerfCmd.exe" /shutdown

Microsoft (R) VSPerf Command Version 10.0.30319 x64

Copyright (C) Microsoft Corp. All rights reserved.

Waiting for process 4420 ( D:\Program Files\Microsoft Webstore\WstJobFrameworkAg

ent.exe) to shutdown...

Waiting for process 6592 ( c:\windows\system32\inetsrv\w3wp.exe) to shutdown...

Shutting down the Profile Monitor

------------------------------------------------------------

9. Refer to C:\183.coverage for the code coverage result.

10. If you see error message like that when you open the .coverage file in Visual Studio 2010, that means you are missing the original instrumented binary files.

11. Copy the missing files from the machine where you ran vsinstr.exe to the exact same folder location. Close the code coverage result by click on the X [remove] button. Re-open the .coverage file to get the following result.