How can I get the execution time of a program in milliseconds in C?

后端 未结 6 1043
清酒与你
清酒与你 2020-12-30 09:28

Currently I\'m getting the execution wall time of my program in seconds by calling:

time_t startTime = time(NULL);
//section of code
time_t         


        
6条回答
  •  清酒与你
    2020-12-30 10:18

    The open-source GLib library has a GTimer system that claims to provide microsecond accuracy. That library is available on Mac OS X, Windows, and Linux. I'm currently using it to do performance timings on Linux, and it seems to work perfectly.

提交回复
热议问题