Share via


DataCollection.ResumeProfile Method

The ResumeProfile method decrements the Suspend/Resume counter for the specified profiling level.

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

Syntax

'Declaration
Public Shared Function ResumeProfile ( _
    profileLevel As ProfileLevel, _
    elementId As UInteger _
) As ProfileOperationResult
public static ProfileOperationResult ResumeProfile(
    ProfileLevel profileLevel,
    uint elementId
)
public:
static ProfileOperationResult ResumeProfile(
    ProfileLevel profileLevel, 
    unsigned int elementId
)
static member ResumeProfile : 
        profileLevel:ProfileLevel * 
        elementId:uint32 -> ProfileOperationResult
public static function ResumeProfile(
    profileLevel : ProfileLevel, 
    elementId : uint
) : 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

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 ResumeProfile method. The example assumes that a call to the SuspendProfile method has been made for the same thread or process identified by DataCollection.CurrentId.

        void ExerciseResumeProfile()
        {
            // 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. 

            // Variables used to print output.
            HRESULT hResult;
            TCHAR tchBuffer[256];

            // Declare enumeration to hold result of call to ResumeProfile
            PROFILE_COMMAND_STATUS profileResult;

            profileResult = ResumeProfile(
                PROFILE_GLOBALLEVEL,
                PROFILE_CURRENTID);

            // Format and print result.
            LPCTSTR pszFormat = TEXT("%s %d.\0");
            TCHAR* pszTxt = TEXT("ResumeProfile returned");
            hResult = StringCchPrintf(tchBuffer, 256, pszFormat, 
                pszTxt, profileResult);
            }

.NET Framework Security

See Also

Reference

DataCollection Class

Microsoft.VisualStudio.Profiler Namespace