std::clock()测量程序持续时间内的时钟周期数.在以下代码中,它是否计算CPU时间或挂钟时间?
std :: clock_t start; 双倍期;
start = std::clock();
/* Your algorithm here */
duration = ( std::clock() - start ) / (double) CLOCKS_PER_SEC;
Run Code Online (Sandbox Code Playgroud)
在另一种情况下,使用以下代码:
std::clock_t start;
double time;
start = std::clock();
time = start / (double) CLOCKS_PER_SEC;
Run Code Online (Sandbox Code Playgroud)
时间的价值是多少?
| 归档时间: |
|
| 查看次数: |
2790 次 |
| 最近记录: |