×

Loading...
Ad by
  • 推荐 OXIO 加拿大高速网络,最低月费仅$40. 使用推荐码 RCR37MB 可获得一个月的免费服务
Ad by
  • 推荐 OXIO 加拿大高速网络,最低月费仅$40. 使用推荐码 RCR37MB 可获得一个月的免费服务

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.