Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

CommentMarkProfileW

Visual Studio 2005

The Unicode version of CommentMarkProfile function inserts a numeric marker and a text string in the .vsp file. For the mark and comment to be inserted, profiling for the thread containing the CommentMarkProfile function must be ON.


PROFILE_COMMAND_STATUS PROFILERAPI CommentMarkProfileW(
                                         long lMarker,
                                         const VSPWCHAR *szComment);

Parameters

lMarker

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

szComment

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

The function indicates success or failure by using PROFILE_COMMAND_STATUS enumeration. The return value can be one of the following:

Enumerator Description

MARK_ERROR_MARKER_RESERVED

The parameter is less than or equal to 0. These values are reserved. The mark and comment are not recorded.

MARK_ERROR_MODE_NEVER

The profiling mode was set to NEVER when the function was called. The mark and comment are not recorded.

MARK_ERROR_MODE_OFF

The profiling mode was set to OFF when the function was called. The mark and comment are not recorded.

MARK_ERROR_NO_SUPPORT

No mark support in this context. The mark and comment are not recorded.

MARK_ERROR_OUTOFMEMORY

Memory was not available to record the event. The mark and comment are not recorded.

MARK_TEXTTOOLONG

The string exceeds the maximum of 256 characters. The comment string is truncated and the mark and comment are recorded.

MARK_OK

MARK_OK is returned to indicate success.

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 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.

NoteImportant

CommentMarkProfile method can only be used with instrumentation.

Microsoft.VisualStudio.Profiler.dll

Header: Declared in VSPerf.h

Import library: VSPerf.lib

The following code illustrates the use of the CommentMarkAtProfile generic function call. The example assumes the use of Win32 string macros and the compiler settings for Unicode to determine if the code calls the Unicode enabled function.

void ExerciseCommentMarkProfile()
{
    // Declare and initialize variables to pass to
    // CommentMarkProfile.  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.
    long markId = 02;
    TCHAR * markText = TEXT("Exercising CommentMarkProfile...");

    // Variables used to print output.
    HRESULT hResult;
    TCHAR tchBuffer[256];

    // Declare enumeration to hold return value of 
    // call to CommentMarkProfile.
    PROFILE_COMMAND_STATUS markResult;

    markResult = CommentMarkProfile(markId, markText);

    // Format and print result.
    LPCTSTR pszFormat = TEXT("%s %d.\0");
    TCHAR* pszTxt = TEXT("CommentMarkProfile returned");
    hResult = StringCchPrintf(tchBuffer, 256, pszFormat, 
        pszTxt, markResult);

#ifdef DEBUG
    OutputDebugString(tchBuffer);
#endif
}
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.