#ifdef_DEBUG#defineENABLED_MEASURE_PERFORMANCE#endif#defineENABLED_MEASURE_PERFORMANCE#ifdefENABLED_MEASURE_PERFORMANCEclassMeasureTime{public:MeasureTime(){memset(&m_startTick,0,sizeof(m_startTick));}~MeasureTime(){}voidStart(std::wstringconst&name){wchar_tstrFormat[512];swprintf_s(strFormat,512,L"[MEASURE TIME - BEGIN] %s\n",name.c_str());OutputDebugString(strFormat);m_name=name;QueryPerformanceFrequency(&m_startTick);m_frequency=((double)m_startTick.QuadPart)/1000.0;QueryPerformanceCounter(&m_startTick);}voidStop(){LARGE_INTEGERcurTick;QueryPerformanceCounter(&curTick);autodelay=curTick.QuadPart-m_startTick.QuadPart;autoelapsed=(double)delay/m_frequency;wchar_tstrFormat[512];swprintf_s(strFormat,512,L"[MEASURE TIME - END ] %s - %lf(ms)\n",m_name.c_str(),elapsed);OutputDebugString(strFormat);}private:LARGE_INTEGERm_startTick;doublem_frequency;std::wstringm_name;};classMeasureTimeScope{public:MeasureTimeScope(std::wstringconst&name){m_measure.Start(name);}MeasureTimeScope(wchar_tconst*name){m_measure.Start(name);}~MeasureTimeScope(){m_measure.Stop();}private:MeasureTimem_measure;};#defineMEASURE_TIME_SCOPE(X)MeasureTimeScopemeasure(L#X)#else#defineMEASURE_TIME_SCOPE(X)#endif