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: System.String
Nazwa elementu profilowania.
- profileLevel
Typ: Microsoft.VisualStudio.Profiler.ProfileLevel
Identyfikuje poziom wykonywania identyfikatora, określonych w elementId.
- elementId
Typ: System.UInt32
Profilowanie identyfikator poziomu.Za pomocą procesu lub wątku identyfikator, który jest generowany przez system.
Wartość zwracana
Typ: Microsoft.VisualStudio.Profiler.NameOperationResult
Wartość zwracana, NameOperationResult, jest wyliczeniem.
Uwagi
Każdy proces lub wątek można przypisać tylko jedną nazwę.Po nazwie elementu profilowania wezwań do NameProfile dla tego elementu są ignorowane.
Jeśli podana jest nazwa tej samej różne wątki lub procesy, w raporcie zostaną uwzględnione dane ze wszystkich elementów na tym poziomie o tej nazwie.
Jeśli określisz, że proces lub wątek, innych niż bieżąca, należy się upewnić, że został zainicjowany i uruchomiona przed nadaj mu nazwę.W przeciwnym wypadku metoda NameProfile kończy się niepowodzeniem.Funkcje zarówno CreateProcess(), jak i CreateThread() API można zwrócić przed wątek lub proces został zainicjowany.
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
- 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 Przy użyciu bibliotek z częściowo zaufanego kodu..