Accurate timing: nanoseconds

Source: Internet
Author: User
Tags emit

// Nanosecond <br/>__ int64 count (void) <br/>{< br/> _ ASM _ emit 0x0f <br/> _ ASM _ emit 0x31 <br/>}</P> <p> cwinapp theapp; </P> <p> using namespace STD; </P> <p> int _ tmain (INT argc, tchar * argv [], tchar * envp []) <br/>{< br/> int nretcode = 0; </P> <p> // an error is displayed when the MFC initialization fails. <br/> If (! Afxwininit (: getmodulehandle (null), null,: getcommandline (), 0) <br/>{< br/> // todo: change error <SPAN class = 'wp _ keywordlink '> Code </span> to meet your needs <br/> _ tprintf (_ T ("Fatal error: MFC initialization failed/N "); <br/> nretcode = 1; <br/>}< br/> else <br/>{< br/> // todo: write code for the behavior of the <SPAN class = 'wp _ keywordlink '> Program </span>. <Br/>}</P> <p> int n1 = count (); <br/> int n2 = gettickcount (); <br/> for (INT I = 0; I <5; I ++) <br/> {<br/> printf ("<timeVal-1> % d/N ", count ()-N1); <br/> n1 = count (); <br/> printf ("<timeVal-2> % d/N", gettickcount ()-N2 ); <br/> n2 = gettickcount (); <br/>}< br/> // For (INT I = 0; I <5; I ++) <br/> // {<br/> // printf ("<timeVal-2> % d/N", gettickcount ()-N2 ); <br/> // n2 = gettickcount (); <br/>/}< br/> system ("pause"); </P> <p> return nretcode; <br/>}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.