DataCollection.SuspendProfile Method (ProfileLevel, UInt32)

 

The SuspendProfile method increments the Suspend/Resume counter for the specified profiling level.

Namespace:   Microsoft.VisualStudio.Profiler
Assembly:  Microsoft.VisualStudio.Profiler (in Microsoft.VisualStudio.Profiler.dll)

Syntax

public static ProfileOperationResult SuspendProfile(
    ProfileLevel profileLevel,
    uint elementId
)
public:
static ProfileOperationResult SuspendProfile(
    ProfileLevel profileLevel,
    unsigned int elementId
)
static member SuspendProfile : 
        profileLevel:ProfileLevel *
        elementId:uint32 -> ProfileOperationResult
Public Shared Function SuspendProfile (
    profileLevel As ProfileLevel,
    elementId As UInteger
) As ProfileOperationResult

Parameters

  • elementId
    Type: System.UInt32

    The process or thread identifier generated by the system.

Return Value

Type: Microsoft.VisualStudio.Profiler.ProfileOperationResult

The return value, ProfileOperationResult, is an enum.

Remarks

SuspendProfile and ResumeProfile control the Suspend/Resume counter for the profiling level. The Suspend/Resume counter is typically used to override the standard profiler API data control functions.

The initial value of the Suspend/Resume counter is 0. Each call to SuspendProfile adds 1 to the Suspend/Resume count; each call to ResumeProfile subtracts 1.

When the Suspend/Resume count is greater than 0, the Suspend/Resume state for the level is OFF. When the count is less than or equal to 0, the Suspend/Resume state is ON.

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 all be ON.

Examples

The following example illustrates the SuspendProfile method. This example assumes that a prior call to StartProfile has been made for the process or thread identified by the property DataCollection.CurrentId.

public void ExerciseSuspendProfile()
{
    // The initial value of the Suspend/Resume counter is 0.
    // Each call to SuspendProfile adds 1 to the 
    // Suspend/Resume count; each call 
    // to ResumeProfile subtracts 1. 

    // Declare enumeration to hold result of call 
    // to SuspendProfile
    ProfileOperationResult profileResult;

    profileResult = DataCollection.SuspendProfile(
        ProfileLevel.Global,
        DataCollection.CurrentId);

    Console.WriteLine("SuspendProfile returned {0}", profileResult);
 }

See Also

DataCollection Class
Microsoft.VisualStudio.Profiler Namespace

Return to top