Metoda DataCollection.StartProfile —
Metoda StartProfile ustawia licznik na 1 (włączone) 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 StartProfile ( _
profileLevel As ProfileLevel, _
elementId As UInteger _
) As ProfileOperationResult
public static ProfileOperationResult StartProfile(
ProfileLevel profileLevel,
uint elementId
)
public:
static ProfileOperationResult StartProfile(
ProfileLevel profileLevel,
unsigned int elementId
)
static member StartProfile :
profileLevel:ProfileLevel *
elementId:uint32 -> ProfileOperationResult
public static function StartProfile(
profileLevel : ProfileLevel,
elementId : uint
) : ProfileOperationResult
Parametry
profileLevel
Typ: Microsoft.VisualStudio.Profiler.ProfileLevelOkreśla poziom wykonywania identyfikator określony w elementId.
elementId
Typ: UInt32Identyfikator procesu lub wątku generowany przez system.
Wartość zwracana
Typ: Microsoft.VisualStudio.Profiler.ProfileOperationResult
Wartość zwracana, ProfileOperationResult, jest typ wyliczeniowy.
Uwagi
StartProfile i StopProfile kontrolują stan Start/Stop poziomu profilowania.Domyślna wartość początkowego uruchomienia i zatrzymania jest 1.W rejestrze można zmienić wartość początkową.Każde wywołanie StartProfile powoduje ustawienie Uruchom/Zatrzymaj 1; Każde wywołanie StopProfile ustawia Uruchom/Zatrzymaj na 0.
Kiedy Start/Stop jest większe od 0, stan Start/Stop dla poziomu to ON.Gdy jest mniejsze lub równe 0 stan Start/Stop to OFF.
Gdy zarówno stan Start/Stop i stan Wstrzymaj/Wznów są włączone, stan profilowania dla poziomu to ON.Dla profilowanego wątku, stany wątku: globalny, procesu i poziomu muszą być włączone.
Przykłady
Poniższy przykład ilustruje metodę StartProfile.
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);
}
Zabezpieczenia programu .NET Framework
- Pełne zaufanie do bezpośredniego wywołującego. Tego elementu członkowskiego nie można używać w kodzie częściowo zaufanym. Aby uzyskać więcej informacji, zobacz Używanie bibliotek pochodzących z częściowo zaufanego kodu.