DataCollection.NameProfile 메서드

NameProfile 메서드는 지정된 프로세스나 스레드에 문자열을 할당합니다.

네임스페이스:  Microsoft.VisualStudio.Profiler
어셈블리:  Microsoft.VisualStudio.Profiler(Microsoft.VisualStudio.Profiler.dll)

구문

‘선언
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

매개 변수

  • profileName
    형식: System.String
    프로파일링 요소의 이름입니다.
  • elementId
    형식: System.UInt32
    프로파일링 수준 식별자입니다.시스템에 의해 생성된 프로세스 또는 스레드 식별자를 사용합니다.

반환 값

형식: Microsoft.VisualStudio.Profiler.NameOperationResult
반환 값 NameOperationResult는 열거형입니다.

설명

각 프로세스나 스레드에는 하나의 이름만 할당할 수 있습니다.프로파일링 요소에 이름을 지정한 뒤에는 해당 요소의 NameProfile에 대한 이후 호출은 무시됩니다.

다른 스레드나 프로세스에 같은 이름이 지정되면 해당 이름의 해당 수준에 있는 모든 요소의 데이터가 보고서에 포함됩니다.

현재 프로세스나 스레드가 아닌 프로세스나 스레드를 지정하는 경우, 초기화되어 실행이 시작된 후 이름을 지정해야 합니다.그렇지 않으면 NameProfile 메서드는 실패합니다.CreateProcess() 및 CreateThread() API 함수 모두 스레드나 프로세스가 초기화되기 전에 반환할 수 있습니다.

예제

다음 예제에서는 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);
        }

.NET Framework 보안

  • 직접 실행 호출자의 경우 완전히 신뢰합니다. 이 멤버는 부분적으로 신뢰할 수 있는 코드에서 사용할 수 없습니다. 자세한 내용은 부분 신뢰 코드에서 라이브러리 사용을 참조하십시오.

참고 항목

참조

DataCollection 클래스

Microsoft.VisualStudio.Profiler 네임스페이스