DataCollection.StartProfile Method
The StartProfile method sets the counter to 1 (on) for the specified profiling level.
Namespace: Microsoft.VisualStudio.Profiler
Assembly: Microsoft.VisualStudio.Profiler (in microsoft.visualstudio.profiler.dll)
Syntax
'Declaration
Public Shared Function StartProfile ( _
profileLevel As ProfileLevel, _
elementId As UInteger _
) As ProfileOperationResult
'Usage
Dim profileLevel As ProfileLevel
Dim elementId As UInteger
Dim returnValue As ProfileOperationResult
returnValue = DataCollection.StartProfile(profileLevel, elementId)
public static ProfileOperationResult StartProfile (
ProfileLevel profileLevel,
uint elementId
)
public:
static ProfileOperationResult StartProfile (
ProfileLevel profileLevel,
unsigned int elementId
)
public static ProfileOperationResult StartProfile (
ProfileLevel profileLevel,
UInt32 elementId
)
public static function StartProfile (
profileLevel : ProfileLevel,
elementId : uint
) : ProfileOperationResult
Parameters
- profileLevel
Identifies the execution level of the identifier specified in elementId.
- elementId
The process or thread identifier generated by the system.
Return Value
The return value, ProfileOperationResult, is an enum.
Remarks
StartProfile and StopProfile control the Start/Stop state for the profiling level. The default initial value of Start/Stop is 1. The initial value can be changed in the registry. Each call to StartProfile sets Start/Stop to 1; each call to StopProfile sets Start/Stop to 0.
When the Start/Stop is greater than 0, the Start/Stop state for the level is ON. When it is less than or equal to 0, the Start/Stop state is OFF.
When the Start/Stop state and the Suspend/Resume state are both ON, the profiling state for the level is ON. For a thread to be profiled, the global, process, and thread level states for the thread must be ON.
Example
The following example illustrates the StartProfile method.
public void ExerciseStartProfile()
{
// StartProfile and StopProfile control the
// Start/Stop state for the profiling level.
// The default initial value of Start/Stop is 1.
// The initial value can be changed in the registry.
// Each call to StartProfile sets Start/Stop to 1;
// each call to StopProfile sets it to 0.
// Declare enumeration to hold return value of
// the call to StartProfile.
ProfileOperationResult profileResult;
profileResult = DataCollection.StartProfile(
ProfileLevel.Global,
DataCollection.CurrentId);
Console.WriteLine("StartProfile returned {0}", profileResult);
}
See Also
Reference
DataCollection Class
DataCollection Members
Microsoft.VisualStudio.Profiler Namespace