次の方法で共有


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
    挿入するテキスト文字列へのポインター。この文字列は、NULL 終端文字を含めて 256 文字未満にする必要があります。

戻り値

型: Microsoft.VisualStudio.Profiler.MarkOperationResult
戻り値の MarkOperationResult は列挙型です。

解説

VSInstr Mark コマンドまたは 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 名前空間