DataCollection.NameProfile (Método)

El método NameProfile asigna una cadena al proceso o subproceso especificado.

Espacio de nombres:  Microsoft.VisualStudio.Profiler
Ensamblado:  Microsoft.VisualStudio.Profiler (en Microsoft.VisualStudio.Profiler.dll)

Sintaxis

'Declaración
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

Parámetros

  • profileName
    Tipo: System.String
    Nombre del elemento de generación de perfiles.
  • elementId
    Tipo: System.UInt32
    Identificador del nivel de generación de perfiles.Se debe utilizar el identificador del proceso o del subproceso generado por el sistema.

Valor devuelto

Tipo: Microsoft.VisualStudio.Profiler.NameOperationResult
El valor devuelto, NameOperationResult, es una enumeración.

Comentarios

Sólo se puede asignar un nombre a cada proceso o subproceso.Una vez asignado el nombre a un elemento de generación de perfiles, se omiten las llamadas subsiguientes a NameProfile para ese elemento.

Si se asigna el mismo nombre a subprocesos o procesos diferentes, el informe incluirá los datos de todos los elementos del nivel que tengan ese nombre.

Si especifica un proceso o subproceso distinto del actual, debe asegurarse de que se haya inicializado y comenzado a ejecutarse antes de asignarle el nombre.De lo contrario, se producirá un error en el método NameProfile.Las funciones API CreateProcess() y CreateThread() pueden devolver valores antes de que se inicialice el subproceso o proceso.

Ejemplos

En el siguiente ejemplo se ilustra el método 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);
        }

Seguridad de .NET Framework

Vea también

Referencia

DataCollection Clase

Microsoft.VisualStudio.Profiler (Espacio de nombres)