This topic has not yet been rated - Rate this topic

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)
public static MarkOperationResult CommentMarkProfile(
	int markId,
	string markText
)

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.

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 note Important

CommentMarkProfile methods should be used with instrumentation only.

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());
            }
        }
Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ
Inappropriate example code
The example code shows how to use MarkProfile() but not how and when to use CommentMarkProfile() instead.