Back in 2006 I wrote a post about a performance dialog that lets you see all of the calls made by the client. It works with Visual Studio (devenv.exe), TFS command line (tf.exe), TCM command line (tcm.exe), Test Manager (mtm.exe), etc.
It’s still in the product in 2010, and it’s as useful as ever if you are writing code that talks to TFS, and you want to optimize for performance. It’s easy for extra calls to creep in, and this is a really easy way to keep track of it. Also, if you find that something seems slow in VS when working with TFS, it provides a way for you to see whether it is calling the server and long it took.
Turning it on is easy. All you need to do is to add the following lines to the bottom of your application’s .exe.config file, just inside the closing </configuration> element. Note that the version number below is for an app using the 2010 TFS client object model. 2008 requires 9.0.0.0, and 2005 requires 8.0.0.0.
<system.diagnostics>
<switches>
<add name="TeamFoundationSoapProxy" value="4" />
</switches>
<trace autoflush="true" indentsize="3">
<listeners>
<add name="perfListener" type="Microsoft.TeamFoundation.Client.PerfTraceListener,Microsoft.TeamFoundation.Client, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
</listeners>
</trace>
</system.diagnostics>
When I edited my devenv.exe.config file to add this, I had to run Notepad (or VS) as an Administrator in order to change the file (I’m using Windows 2008 Server R2, and I expect Windows 7 requires the same).
Here’s an updated screen shot showing calls made by Visual Studio 2010 in connecting to a team project on a 2010 server.
If you hover over one of the lines in the bottom panel, you’ll get the stack trace for the call.
If you select rows from the grid, you can paste them into another document, such as a spreadsheet. Here I selected all of the rows in the top panel and pasted the results.
WebService | TotalTime | Last | Count | Average | Min Time | Max Time | |
---|---|---|---|---|---|---|---|
QueryNodes[Administration] | 3711 | 1545 | 6 | 618 | 190 | 1545 | |
ListChildren[ReportServer] | 3610 | 3610 | 1 | 3610 | 3610 | 3610 | |
GetMetadataEx2[WorkItemTracking] | 2256 | 1926 | 2 | 1128 | 330 | 1926 | |
ReadIdentities[Services] | 1155 | 767 | 2 | 577 | 388 | 767 | |
Connect[Services] | 777 | 777 | 1 | 777 | 777 | 777 | |
QueryItems[VersionControl] | 710 | 187 | 2 | 355 | 187 | 523 | |
QuerySecurityNamespaces[Services] | 632 | 632 | 1 | 632 | 632 | 632 | |
GetRegistrationEntries[Services] | 605 | 605 | 1 | 605 | 605 | 605 | |
GetListCollection[SharePoint] | 534 | 534 | 1 | 534 | 534 | 534 | |
QueryPendingSets[VersionControl] | 498 | 498 | 1 | 498 | 498 | 498 | |
QueryWorkspaces[VersionControl] | 470 | 470 | 1 | 470 | 470 | 470 | |
QueryBuildDefinitions[Build] | 442 | 442 | 1 | 442 | 442 | 442 | |
GetStoredQueryItems[WorkItemTracking] | 353 | 353 | 1 | 353 | 353 | 353 | |
QueryCheckinNoteDefinition[VersionControl] | 294 | 294 | 1 | 294 | 294 | 294 | |
GetProperties[Administration] | 292 | 292 | 1 | 292 | 292 | 292 | |
QueryResourceTypes[Administration] | 231 | 231 | 1 | 231 | 231 | 231 | |
QueryResources[Administration] | 213 | 213 | 1 | 213 | 213 | 213 | |
QueryPermissions[Services] | 198 | 198 | 1 | 198 | 198 | 198 | |
Connect[Administration] | 181 | 181 | 1 | 181 | 181 | 181 |
Enjoy!
0 comments
Be the first to start the discussion.