Поделиться через


DataCollection.CommentMarkProfile - метод

Метод CommentMarkProfile вставляет числовой маркер и текстовую строку в VSP-файл.Чтобы были вставлены метка и комментарий, необходимо, чтобы было включено профилирование для потока, содержащего функцию CommentMarkProfile.

Пространство имен:  Microsoft.VisualStudio.Profiler
Сборка:  Microsoft.VisualStudio.Profiler (в Microsoft.VisualStudio.Profiler.dll)

Синтаксис

'Декларация
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

Параметры

  • markId
    Тип: System.Int32
    Числовая метка для вставки.Метка должна быть больше или равна нулю (0).
  • markText
    Тип: System.String
    Указатель на вставляемую текстовую строку.Длина строки не должна превышать 256 знаков, включая токен конца строки NULL.

Возвращаемое значение

Тип: Microsoft.VisualStudio.Profiler.MarkOperationResult
Возвращаемое значение MarkOperationResult является перечислением.

Заметки

Состояние профилирования для потока, который содержит функцию профиля метки, должно быть включено, если метки и комментарии вставлены при помощи команды Mark VSInstr или функций-членов Microsoft.VisualStudio.Profiler.DataCollection (CommentMarkAtProfile, CommentMarkProfile или MarkProfile).

Метки профилирования имеют глобальную область видимости.Например, метка профиля, вставленная в поток, может использоваться для отметки начала и конца сегмента данных в любом потоке, определенном в .VSP-файле.

Важное примечаниеВажно

Методы CommentMarkProfile должны использоваться только с использованием инструментирования.

Примеры

Следующий пример иллюстрирует использование метода 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());
            }
        }

Безопасность платформы .NET Framework

См. также

Ссылки

DataCollection Класс

Microsoft.VisualStudio.Profiler - пространство имен