DataCollection.CommentMarkProfile Method
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
'Declaration
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
Parameters
markId
Type: System.Int32The numeric marker to insert. The marker must greater than or equal to 0 (zero).
markText
Type: System.StringA 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());
}
}
.NET Framework Security
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.