DataCollection.MarkProfile Method (Int32)
The MarkProfile method inserts a profile mark in the .vsp file. Profiling for the thread containing the MarkProfile function must be ON for the mark to be inserted.
Namespace: Microsoft.VisualStudio.Profiler
Assembly: Microsoft.VisualStudio.Profiler (in Microsoft.VisualStudio.Profiler.dll)
Syntax
public static MarkOperationResult MarkProfile(
int markId
)
public:
static MarkOperationResult MarkProfile(
int markId
)
static member MarkProfile :
markId:int -> MarkOperationResult
Public Shared Function MarkProfile (
markId As Integer
) As MarkOperationResult
Parameters
markId
Type: System.Int32The marker to insert. The marker must be greater than or equal to 0 (zero).
Return Value
Type: Microsoft.VisualStudio.Profiler.MarkOperationResult
The return value, MarkOperationResult, is an enum.
Remarks
The mark value is inserted into the .vsp file each time the code runs if the thread containing the MarkProfile function is being profiled. You can call MarkProfile multiple times.
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.
The profiling state for the thread that contains the mark profile function must be on when marks and comments inserted with the Mark command or with API functions (CommentMarkAtProfile, CommentMarkProfile, or MarkProfile).
Important
MarkProfile methods should be used with instrumentation only.
Examples
The following example illustrates the MarkProfile method.
public void ExerciseMarkProfile()
{
// 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 = 03;
// Declare enumeration to hold return value of
// call to MarkProfile.
MarkOperationResult markResult;
markResult = DataCollection.MarkProfile(
markId);
Console.WriteLine("MarkProfile returned {0}", markResult);
}
See Also
DataCollection Class
Microsoft.VisualStudio.Profiler Namespace
Return to top