×

Loading...
Ad by
  • 技多不压身,工到自然成:安省技工证书特训班,点击咨询报名!
Ad by
  • 技多不压身,工到自然成:安省技工证书特训班,点击咨询报名!

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.