Windows 下精確時間控制

來源:互聯網
上載者:User


Windows 下精確時間控制


I'm totally occupied recently.... :-( , i just can't spare out to type a word on the blog...
for measuring the time accuratly, I wrote double classes and share it...

copy too much code from CodeProject.com, so i contribute some...LOL

實在太忙……
最近要編寫一個即時波形繪圖程式,對時間要求比較高,研究了一下,寫出兩個類.共用源碼...

StopWatch
class MMTimer;
Description:
the class StopWatch for measuring the duration accuratly, 1ms differency.
the class MMTimer for triggering a callback function periodicly...

Example:
1)
StopWatch watch;
watch.Start();
//....your code to measure...
watch.Stop();

double duration = watch.Duration(); // in milliseconds

2)

MMTimer<CDialog1> timer;
timer.Start(10, this, &CDialog1::YourVoidProc);
...
代碼:
 StopWatch StopWatch m_nFrequencyQueryPerformanceFrequencym_query   m_nFrequency m_queryQuadPart  Start Start  QueryPerformanceCounterm_query  m_nPrevCount m_queryQuadPart Stop  QueryPerformanceCounterm_query  m_nCurrCount m_queryQuadPart Durationm_nFrequencym_nCurrCount m_nPrevCount m_nFrequency __int64 m_nFrequency __int64 m_nPrevCount __int64 m_nCurrCount LARGE_INTEGER m_query T MMTimerTCallBackProcMMTimer m_nResolution m_nTimerIdNULL m_lpCallFromNULLTIMECAPS tctimeGetDevCapstcTIMECAPS TIMERR_NOERRORm_nResolution tcwPeriodMintimeBeginPeriodm_nResolution Start nDelay T lpCallFrom CallBackProc lpCallBackProcm_lpCallFrom lpCallFromm_callback lpCallBackProcm_nTimerId timeSetEventnDelay m_nResolution callbackDWORD_PTR TIME_PERIODIC m_nTimerId NULL Stopm_nTimerIdMMRESULT result timeKillEventm_nTimerIdresult TIMERR_NOERRORm_nTimerId result TIMERR_NOERRORMMTimerStopm_nResolutiontimeEndPeriodm_nResolution CALLBACK callbackUINT uTimerID UINT uMsg DWORD_PTR dwUser DWORD_PTR dw1 DWORD_PTR dw2MMTimerT lpTimerMMTimerTdwUserlpTimerm_lpCallFromlpTimerm_callbackCallBackProc m_callbackT m_lpCallFrom m_nResolution m_nTimerId
相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.