DataCollection at the Global Level
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
- Anonymous
March 06, 2006
The comment has been removed - Anonymous
November 26, 2007
PingBack from http://feeds.maxblog.eu/item_1046827.html - Anonymous
May 29, 2009
The comment has been removed