Megosztás a következőn keresztül:


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.

Classes

  Class Description
Public class DataCollection The 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.

Enumerations

  Enumeration Description
Public enumeration MarkOperationResult CommentMarkAtProfile, CommentMarkProfile, and MarkProfile return success or failure using the MarkOperationResult enum.
Public enumeration NameOperationResult NameProfile method returns NameOperationResult enum to indicate success or failure.
Public enumeration ProfileLevel ProfileLevel enum is used indicate one of the three levels to which performance data collection can be applied.
Public enumeration ProfileOperationResult ResumeProfile, StartProfile, StopProfile, and SuspendProfile return success or failure using the ProfileOperationResult enum.