#keywords MFC, 시간측정, winmm.lib {{{#!gcode #include #pragma comment(lib, "winmm.lib") // 또는 winmm.lib를 추가 라이브러리에 등록하고 #include "Mmsystem.h" BOOL working = FALSE; DWORD startTime = timeGetTime(); while (working) { working = finder.FindNextFileW(); if (!(finder.IsDirectory() || finder.IsDots())) { fileName = finder.GetFileName(); ++searched; staticDisplay.SetWindowTextW(fileName + _T(" ... done")); listResult.InsertItem(seq, fileName); listResult.SetItem(seq, 1, LVIF_TEXT, finder.GetFileURL(), 0, 0, 0, NULL); listResult.SetItem(seq++, 2, LVIF_TEXT, finder.GetFilePath(), 0, 0, 0, NULL); } } DWORD elapsedTime = timeGetTime(); CString timeResult; timeResult.Format(_T("%d개 찾음, 실행시간 %.3lf sec"), searched, (elapsedTime - startTime) / 1000.0); }}} ==== 기타 ==== mill-second까지 계측할 때는 아래 함수들을 사용한다. * GetTickCound * timeGetTime : (Windows.h와 winmm.lib) GetTickCount은 시스템 타이머 정밀도에 따라 최소 정밀도는 10~16ms 정도 된다. timeGetTime은 멀티미디어 타이머에 영향을 받아 보통 5ms 이상이다(머신에 따라 다르다.). timeGetTime의 경우 다음 같이 정밀도를 끌어 올릴 수 있다. {{{#!gcode timeBeginPeriod(1); ... // timeGetTime 사용 ... // timeEndPeriod의 인자 값은 timeBeginPeriod에서 설정한 인자 값과 동일해야 한다 timeEndPeriod(1); }}} 이(milli-second)보다 더 높은 정밀도의 계측 도구가 필요한 경우 유일한 대안은 QueryPerformanceQuery / QueryPerformanceCounter 이다. ---- {{{ 13개 찾음, 실행시간 0.009 sec }}}