Udostępnij za pośrednictwem


Metoda DataCollection.NameProfile —

Metoda NameProfile przypisuje ciąg określony proces lub wątek.

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

Składnia

'Deklaracja
Public Shared Function NameProfile ( _
    profileName As String, _
    profileLevel As ProfileLevel, _
    elementId As UInteger _
) As NameOperationResult
public static NameOperationResult NameProfile(
    string profileName,
    ProfileLevel profileLevel,
    uint elementId
)
public:
static NameOperationResult NameProfile(
    String^ profileName, 
    ProfileLevel profileLevel, 
    unsigned int elementId
)
static member NameProfile : 
        profileName:string * 
        profileLevel:ProfileLevel * 
        elementId:uint32 -> NameOperationResult
public static function NameProfile(
    profileName : String, 
    profileLevel : ProfileLevel, 
    elementId : uint
) : NameOperationResult

Parametry

  • profileName
    Typ: String

    Nazwa elementu profilowania.

  • elementId
    Typ: UInt32

    Identyfikator poziomu profilowania.Należy użyć identyfikatora procesu lub wątku, wygenerowanego przez system.

Wartość zwracana

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

Uwagi

Każdemu procesowi lub wątkowi można przypisać tylko jedną nazwę.Po nazwaniu elementu profilowania kolejne wywołania funkcji NameProfile dla tego elementu są ignorowane.

Jeśli ta sama nazwa jest podana dla różnych wątków lub procesów, raport będzie zawierał dane ze wszystkich elementów na tym poziomie z tą samą nazwą.

Jeśli określisz proces lub wątek innego niż bieżący, należy się upewnić, że został zainicjowany i rozpoczęte przed nadaj mu nazwę.W przeciwnym wypadku metoda NameProfile nie zadziała.Funkcje zarówno CreateProcess(), jak i CreateThread() API można przekazać przed wątku lub procesu jest inicjowany.

Przykłady

Poniższy przykład ilustruje metodę NameProfile.

        public void ExerciseNameProfile()
        {
            // Create and initalize variables to pass to 
            // ExerciseNameProfile.  The values of this 
            // parameter is based on the needs of the code;
            // and for the sake of simplicity in this example, 
            // the variable is assigned 
            // an arbitrary value.
            string profileName = "ExerciseNameProfile";

            // Declare enumeration to hold result of call to 
            // ExerciseNameProfle.
            NameOperationResult nameResult;

            nameResult =  DataCollection.NameProfile(
                profileName,
                ProfileLevel.Global,
                DataCollection.CurrentId);

            Console.WriteLine("NameProfile returned {0}", nameResult);
        }

Zabezpieczenia programu .NET Framework

Zobacz też

Informacje

DataCollection Klasa

Przestrzeń nazw Microsoft.VisualStudio.Profiler