DataCollection.CommentMarkProfile メソッド

更新 : 2007 年 11 月

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
'使用
Dim markId As Integer
Dim markText As String
Dim returnValue As MarkOperationResult

returnValue = DataCollection.CommentMarkProfile(markId, _
    markText)
public static MarkOperationResult CommentMarkProfile(
    int markId,
    string markText
)
public:
static MarkOperationResult CommentMarkProfile(
    int markId, 
    String^ markText
)
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());
            }
        }

アクセス許可

  • 直前の呼び出し元に対する完全な信頼。このメンバは、部分的に信頼されているコードから使用することはできません。詳細については、「部分信頼コードからのライブラリの使用」を参照してください。

参照

参照

DataCollection クラス

DataCollection メンバ

Microsoft.VisualStudio.Profiler 名前空間