PROFILE_CURRENTID

The PROFILE_CURRENTID returns the pseudo-token for the thread id or process id, in a call to NameProfile, StartProfile, StopProfile, SuspendProfile, and ResumeProfile functions. Use it to cause the function to operate on the current thread or process, rather than a specifically indicated one.

Example

PROFILE_CURRENTID is defined in VSPerf.h as:

static const unsigned int PROFILE_CURRENTID = (unsigned int)-1;

The following example illustrates PROFILE_CURRENTID. The example uses PROFILE_CURRENTID as a parameter identifying the current thread in a call to the StartProfile function.

void ExerciseProfileCurrentID()
{
    // Declare ProfileOperationResult enumeration 
    // to hold return value of a call to StartProfile.
    PROFILE_COMMAND_STATUS profileResult;

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

    profileResult = StartProfile(
        PROFILE_GLOBALLEVEL,
        PROFILE_CURRENTID);

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

#ifdef DEBUG
    OutputDebugString(tchBuffer);
#endif
}

See Also

Reference

NameProfile

ResumeProfile

StartProfile

StopProfile

SuspendProfile

Other Resources

Visual Studio Profiler API Reference (Native)