Accurate Determination of processing time when using opencv for image processing

Source: Internet
Author: User

# Include <stdio. h>
# Include <math. h>
# Include <OMP. h>
# Include <windows. h>
Large_integer m_liperffreq;
Large_integer m_liperfstart;
Large_integer liperfnow;
Double dftim;
Void getstarttime ()
{
Queryperformancefrequency (& m_liperffreq );
Queryperformancecounter (& m_liperfstart );
}

Void getendtime ()
{
Queryperformancecounter (& liperfnow );
Dftim = (liperfnow. quadpart-m_liperfstart.quadpart) * 1000.0f)/m_liperffreq.quadpart );
}

Void main ()
{
Static long num_steps= 1000000;
Double step, PI;
Double X, sum = 0.0;
Int I = 0;
Step = 1.0/(double) num_steps;
Getstarttime ();

// # Pragma OMP parallel for private (x) ction (+: Sum)
For (I = 0; I <num_steps; I ++)
{
X = (I + 0.5) * step;
Sum + = 4.0/(1.0 + x * X );
// Printf ("% F, % d \ n", omp_get_thread_num ());
}
Getendtime ();
Printf ("% F \ n", dftim );
Pi = Step * sum;
Printf ("Pi = % F \ n", Pi );

}

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.