DataCollection at the Global Level

Published 10 October 05 10:41 AM | AngryRichard 

If you are using the DataCollection API (either from native, by linking agains VSPerf.lib, or from managed, by importing Microsoft.VisualStudio.Profiler.dll), and wish to enable or disable collection at the global level, you must pass CurrentId for the elementId parameter:

  using Microsoft.VisualStudio.Profiler;

  [Not so interesting code here]  

  DataCollection.StartProfile(
      ProfileLevel.Global,
      DataCollection.CurrentId);

  [Interesting code here]

Similarly, for native code:

  #include "VSPerf.h"

  [Not so interesting code here]

  StartProfile(PROFILE_GLOBALLEVEL, PROFILE_CURRENTID);

  [Interesting code here]

Note that both the native and managed versions return zero on success, so it is possible to detect whether the call succeeded:

C# c++ Description
ProfileOperationResult.ErrorNotYetImplemented PROFILE_ERROR_NOT_YET_IMPLEMENTED API level, id combination not supported
ProfileOperationResult.ErrorModeNever PROFILE_ERROR_MODE_NEVER Global mode was "never" when called
ProfileOperationResult.ErrorLevelDoesNotExist PROFILE_ERROR_LEVEL_NOEXIST Profile level does not exist
ProfileOperationResult.ErrorIdDoesNotExist PROFILE_ERROR_ID_NOEXIST Element id doesn't exist

Comments

# IanWho's bLog said on March 6, 2006 3:46 PM:
The profiler team has been crazy busy with getting Visual Studio Team System shipped and out the door,...
# DataCollection at the Global Level said on November 26, 2007 1:59 PM:

PingBack from http://feeds.maxblog.eu/item_1046827.html

# Angry Richard s WebLog DataCollection at the Global Level | Paid Surveys said on May 29, 2009 8:57 PM:

PingBack from http://paidsurveyshub.info/story.php?title=angry-richard-s-weblog-datacollection-at-the-global-level

Anonymous comments are disabled

Search

This Blog

Syndication

Page view tracker