How to measure the time that a piece of code takes to execute?

后端 未结 4 720
说谎
说谎 2020-12-17 01:14

Suppose I want to measure the time that a certain piece of code takes. For that I would normally do something like this

clock_t startTime = clock();
//do stu         


        
4条回答
  •  庸人自扰
    2020-12-17 01:15

    From the Linux terminal use 'time path_to_app'

    This will return everything you want to know.

提交回复
热议问题