Metodo DataCollection.CommentMarkProfile

Il metodo CommentMarkProfile inserisce un indicatore numerico e una stringa di testo nel file vsp. Il profilo del thread contenente la funzione CommentMarkProfile deve essere impostato su ON per consentire l'inserimento dell'indicatore e del commento.

Spazio dei nomi:  Microsoft.VisualStudio.Profiler
Assembly:  Microsoft.VisualStudio.Profiler (in Microsoft.VisualStudio.Profiler.dll)

Sintassi

'Dichiarazione
Public Shared Function CommentMarkProfile ( _
    markId As Integer, _
    markText As String _
) As MarkOperationResult
public static MarkOperationResult CommentMarkProfile(
    int markId,
    string markText
)
public:
static MarkOperationResult CommentMarkProfile(
    int markId, 
    String^ markText
)
static member CommentMarkProfile : 
        markId:int * 
        markText:string -> MarkOperationResult 
public static function CommentMarkProfile(
    markId : int, 
    markText : String
) : MarkOperationResult

Parametri

  • markId
    Tipo: System.Int32
    Indicatore numerico da inserireche deve essere maggiore o uguale a 0 (zero).
  • markText
    Tipo: System.String
    Puntatore alla stringa di testo da inserire.La stringa deve contenere meno di 256 caratteri, incluso il carattere di terminazione NULL.

Valore restituito

Tipo: Microsoft.VisualStudio.Profiler.MarkOperationResult
Il valore restituito, MarkOperationResult, è un'enumerazione.

Note

La stato di analisi per il thread contenente la funzione relativa all'indicatore di analisi deve essere impostato su ON quando vengono inseriti indicatori e commenti con il comando Mark di VSInstr o con le funzioni membro di Microsoft.VisualStudio.Profiler.DataCollection (CommentMarkAtProfile, CommentMarkProfile o MarkProfile).

Gli indicatori di profilo hanno un ambito globale. Un indicatore di profilo inserito in un thread può, ad esempio, essere utilizzato per contrassegnare l'inizio o la fine di un segmento di dati in qualsiasi thread del file vsp.

Nota importanteImportante

I metodi CommentMarkProfile vanno utilizzati esclusivamente con la strumentazione.

Esempi

Nell'esempio riportato di seguito viene illustrato il metodo MarkOperationResult.

        public void ExerciseMarkOperationResult()
        {
            // Declare and initialize variables to pass to
            // MarkProfile.  The values of these parameters
            // are assigned based on the needs of the code;
            // and for the sake of simplicity in this example,
            // the variables are assigned arbitrary values.
            int markID = 4;

            // Declare enumeration to hold return value of 
            // call to MarkProfile.
            MarkOperationResult result;

            result = DataCollection.MarkProfile(markID);

            // Compare result to MarkOperationResult value.  
            // In this case, the property value of 
            // MarkOperationResult is "OK".
            if (result == MarkOperationResult.OK)
            {
                Console.WriteLine("PASS -- Test {0}", result);
            }
            else
            {
                Console.WriteLine("FAIL -- MarkProfile Returned code {0} with normal input", result.ToString());
            }
        }

Sicurezza di .NET Framework

Vedere anche

Riferimenti

DataCollection Classe

Spazio dei nomi Microsoft.VisualStudio.Profiler