How to see the TFS server calls made by the client

Avatar

Buck

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.

image

If you hover over one of the lines in the bottom panel, you’ll get the stack trace for the call.

image

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.

 WebServiceTotalTimeLastCountAverageMin TimeMax Time
 QueryNodes[Administration]3711154566181901545
 ListChildren[ReportServer]361036101361036103610
 GetMetadataEx2[WorkItemTracking]22561926211283301926
 ReadIdentities[Services]11557672577388767
 Connect[Services]7777771777777777
 QueryItems[VersionControl]7101872355187523
 QuerySecurityNamespaces[Services]6326321632632632
 GetRegistrationEntries[Services]6056051605605605
 GetListCollection[SharePoint]5345341534534534
 QueryPendingSets[VersionControl]4984981498498498
 QueryWorkspaces[VersionControl]4704701470470470
 QueryBuildDefinitions[Build]4424421442442442
 GetStoredQueryItems[WorkItemTracking]3533531353353353
 QueryCheckinNoteDefinition[VersionControl]2942941294294294
 GetProperties[Administration]2922921292292292
 QueryResourceTypes[Administration]2312311231231231
 QueryResources[Administration]2132131213213213
 QueryPermissions[Services]1981981198198198
 Connect[Administration]1811811181181181

Enjoy!

Avatar
Buck Hodges

Follow Buck   

No Comments.