DataCollection.CommentMarkProfile Method (Int32, String)

 

The CommentMarkProfile method inserts a numeric marker and a text string in the .vsp file. Profiling for the thread containing the CommentMarkProfile function must be ON for the mark and comment to be inserted.

Namespace:   Microsoft.VisualStudio.Profiler
Assembly:  Microsoft.VisualStudio.Profiler (in Microsoft.VisualStudio.Profiler.dll)

Syntax

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 Shared Function CommentMarkProfile (
    markId As Integer,
    markText As String
) As MarkOperationResult

Parameters

  • markId
    Type: System.Int32

    The numeric marker to insert. The marker must greater than or equal to 0 (zero).

  • markText
    Type: System.String

    A pointer to the text string to insert. The string must be less than 256 characters including the NULL terminator.

Return Value

Type: Microsoft.VisualStudio.Profiler.MarkOperationResult

The return value, MarkOperationResult, is an enum.

Remarks

The profiling state for the thread that contains the mark profile function must be on when marks and comments inserted with the VSInstr Mark command or with Microsoft.VisualStudio.Profiler.DataCollection member functions (CommentMarkAtProfile, CommentMarkProfile, or MarkProfile).

Profile marks are global in scope. For example, a profile mark inserted in one thread can be used to mark the start or end of a data segment in any thread in the .vsp file.

Important

CommentMarkProfile methods should be used with instrumentation only.

Examples

The following example illustrates the MarkOperationResult method.

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());
    }
}

See Also

DataCollection Class
Microsoft.VisualStudio.Profiler Namespace

Return to top