We recommend using Visual Studio 2017
This documentation is archived and is not being maintained.


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.

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.

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

    profileResult = StartProfile(

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

#ifdef DEBUG