StopProfile
The StopProfile function sets the counter to 0 (off).
StartProfile and StopProfile control the Start/Stop state for the profiling level. The default value of Start/Stop is 1. The initial value can be changed in the registry. Each call to StartProfile sets Start/Stop to 1; each call to StopProfile sets it to 0.
When the Start/Stop is greater than 0, the Start/Stop state for the level is ON. When it is less than or equal to 0, the Start/Stop state is OFF.
When the Start/Stop state and the Suspend/Resume state are both ON, the profiling state for the level is ON. For a thread to be profiled, the global, process, and thread level states for the thread must be ON.
The following example illustrates the StopProfile method. The example assumes that a call to the StartProfile method has been made for the same thread or process identified by PROFILE_CURRENTID.
void ExerciseStopProfile() { // StartProfile and StopProfile control the // Start/Stop state for the profiling level. // The default initial value of Start/Stop is 1. // The initial value can be changed in the registry. // Each call to StartProfile sets Start/Stop to 1; // each call to StopProfile sets it to 0. // Variables used to print output. HRESULT hResult; TCHAR tchBuffer[256]; // Declare enumeration to hold result of call // to StopProfile. PROFILE_COMMAND_STATUS profileResult; profileResult = StopProfile( PROFILE_THREADLEVEL, PROFILE_CURRENTID); // Format and print result. LPCTSTR pszFormat = TEXT("%s %d.\0"); TCHAR* pszTxt = TEXT("StopProfile returned"); hResult = StringCchPrintf(tchBuffer, 256, pszFormat, pszTxt, profileResult); #ifdef DEBUG OutputDebugString(tchBuffer); #endif }