This documentation is archived and is not being maintained.

Microsoft.VisualStudio.Profiler Namespace

The Microsoft.VisualStudio.Profiler namespace enables you to programmatically control performance data collection from within the application. This approach is useful, for example, if you want to collect performance data in the scope of a function or you want to avoid gathering performance data of a larger framework in which your code is executing. Another example where this approach is useful is, if you want to gather performance data of a specific thread from a group of threads.

In sampling mode, the following limitations exist:

  1. Suspend/Resume is not supported.

  2. Start/Stop at thread level not supported in sampling mode.

For information on native APIs, see VSPerf.h file.

Public classDataCollectionThe DataCollection class enables you to programmatically control the amount of data collected during profiling in the .vsp file. To programmatically control data collection, use methods and property of the DataCollection class in your managed code.

Public enumerationMarkOperationResultCommentMarkAtProfile, CommentMarkProfile, and MarkProfile return success or failure using the MarkOperationResult enum.
Public enumerationNameOperationResultNameProfile method returns NameOperationResult enum to indicate success or failure.
Public enumerationProfileLevelProfileLevel enum is used indicate one of the three levels to which performance data collection can be applied.
Public enumerationProfileOperationResultResumeProfile, StartProfile, StopProfile, and SuspendProfile return success or failure using the ProfileOperationResult enum.