Udostępnij za pośrednictwem


Metoda DataCollection.SuspendProfile —

Metoda SuspendProfile zwiększa licznik wstrzymania/Wznowienie 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: System.UInt32
    Identyfikator procesu lub wątku generowane przez system.

Wartość zwracana

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

Uwagi

SuspendProfile i ResumeProfile kontroli licznik wstrzymania/Wznowienie 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 zliczania Wstrzymaj/Wznów; Każde wywołanie ResumeProfile odejmuje 1.

Gdy licznik wstrzymania/Wznowienie jest większa niż 0, stan wstrzymania/Wznowienie dla poziomu jest wyłączona.Gdy ta liczba jest mniejsza niż lub równa 0, stan wstrzymania/Wznowienie jest włączone.

Gdy stan uruchomienia i zatrzymania i stan wstrzymania/Wznowienie są zarówno na, stan profilowania dla poziomu jest włączone.Dla wątku za profilowane, globalne, proces i poziomu wątku Państwa dla wątku musi składać się na.

Przykłady

Poniższy przykład ilustruje metodę SuspendProfile.W tym przykładzie założono, że dokonano uprzednim zaproszeniem do StartProfile proces lub wątek identyfikowany 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