×

Loading...
Ad by
  • 最优利率和cashback可以申请特批,好信用好收入offer更好。请点链接扫码加微信咨询,Scotiabank -- Nick Zhang 6478812600。
Ad by
  • 最优利率和cashback可以申请特批,好信用好收入offer更好。请点链接扫码加微信咨询,Scotiabank -- Nick Zhang 6478812600。

How to caculate CPU time of calling a function in C++.

Hi,
I have a Matlab program need to rewrite into C/C++ code. There is a built-in Matlab function "cputime" used in the Matlab program to return the CPU time used to run other user-defined function in another file. The usage in Matlab is " start=cputime ; function();//this function is defined in another file.. total=cputime-start" .So in this way to caculate CPU time for calling function. But i dont know what's the correspondent way to do it in C++. Any help is appreciated. Thanks everyone!!!!
Report

Replies, comments and Discussions:

  • 工作学习 / 学科技术讨论 / How to caculate CPU time of calling a function in C++.
    Hi,
    I have a Matlab program need to rewrite into C/C++ code. There is a built-in Matlab function "cputime" used in the Matlab program to return the CPU time used to run other user-defined function in another file. The usage in Matlab is " start=cputime ; function();//this function is defined in another file.. total=cputime-start" .So in this way to caculate CPU time for calling function. But i dont know what's the correspondent way to do it in C++. Any help is appreciated. Thanks everyone!!!!
    • windows?
    • GetTickCount
    • Thanks everyone. I resolved this issue using built-in windows function.