Aracılığıyla paylaş


DataCollection.NameProfile Yöntem

NameProfile yöntemi, belirtilen işlem veya iş parçacığı bir dize atar.

Ad alanı:  Microsoft.VisualStudio.Profiler
Derleme:  Microsoft.VisualStudio.Profiler (Microsoft.VisualStudio.Profiler.dll içinde)

Sözdizimi

'Bildirim
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

Parametreler

  • profileName
    Tür: System.String
    Profil oluşturma öğesinin adı.
  • elementId
    Tür: System.UInt32
    Profil oluşturma düzeyi tanıtıcısı.Sistem tarafından oluşturulan bir tanımlayıcı iş parçacığı veya işlem kullanın.

Dönüş Değeri

Tür: Microsoft.VisualStudio.Profiler.NameOperationResult
Dönüş değeri, NameOperationResult, enum ' dir.

Notlar

Her işlem veya iş parçacığı için yalnızca bir ad atanabilir.Profil oluşturma öğe adlı sonra o öğe için sonraki çaðrýlar NameProfile göz ardı edilir.

Farklı iş parçacıkları veya işlemler için aynı ad verilir, rapor verileri aynı düzeyde aynı ada sahip tüm öğeleri içerir.

Bir işlem veya iş parçacığı mevcut olandan başka belirtirseniz, başlatılmış ve olduğundan, adı önce çalışan başladı olduğunu emin olmanız gerekir.Aksi halde, NameProfile yöntemi başarısız olur.Önce iş parçacığı CreateProcess() ve CreateThread() API işlevleri döndürebilir veya işlemi başlatılır.

Örnekler

Aşağıdaki örnekte, NameProfile yöntemi gösterilmektedir.

        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);
        }

.NET Framework Güvenliği

Ayrıca bkz.

Başvuru

DataCollection Sınıf

Microsoft.VisualStudio.Profiler Ad Alanı