Udostępnij za pośrednictwem


Metoda DataCollection.SuspendProfile —

Metoda SuspendProfile zwiększa o jeden licznik Wstrzymaj/Wznów dla określonego poziomu profilowania.

Przestrzeń nazw:  Microsoft.VisualStudio.Profiler
Zestaw:  Microsoft.VisualStudio.Profiler (w Microsoft.VisualStudio.Profiler.dll)

Składnia

'Deklaracja
Public Shared Function SuspendProfile ( _
    profileLevel As ProfileLevel, _
    elementId As UInteger _
) As ProfileOperationResult
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 static function SuspendProfile(
    profileLevel : ProfileLevel, 
    elementId : uint
) : ProfileOperationResult

Parametry

  • elementId
    Typ: UInt32

    Identyfikator procesu lub wątku generowany przez system.

Wartość zwracana

Typ: Microsoft.VisualStudio.Profiler.ProfileOperationResult
Wartość zwracana, ProfileOperationResult, jest typ wyliczeniowy.

Uwagi

SuspendProfile i ResumeProfile kontroli licznika Wstrzymaj/Wznów dla poziomu profilowania.Wstrzymaj/Wznów licznika jest zazwyczaj używany do zastępują funkcje kontroli danych profiler standardowego interfejsu API.

Początkowa wartość licznika Wstrzymaj/Wznów to 0.Każde wywołanie SuspendProfile dodaje 1 do licznika Wstrzymaj/Wznów; każde wywołanie ResumeProfile odejmuje od niego 1.

Gdy licznik Wstrzymaj/Wznów jest większy niż 0, stan Wstrzymaj/Wznów dla poziomu jest wyłączony.Kiedy licznik jest mniejszy lub równy 0, stan Wstrzymaj/Wznów jest włączony.

Gdy zarówno stan Start/Stop i stan Wstrzymaj/Wznów są włączone, stan profilowania dla poziomu to ON.Dla profilowanego wątku, wszystkie stany wątku: globalny, procesu i poziomu wątku muszą być włączone.

Przykłady

Poniższy przykład demonstruje metodę SuspendProfile.W tym przykładzie założono, że dokonano zaproszenia do StartProfile dla procesu lub wątku identyfikowane przez właściwość 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);
         }

Zabezpieczenia programu .NET Framework

Zobacz też

Informacje

DataCollection Klasa

Przestrzeń nazw Microsoft.VisualStudio.Profiler