C++中计时函数使用

Posted 星火撩猿

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了C++中计时函数使用相关的知识,希望对你有一定的参考价值。

#include <iostream>
using namespace std;

int main()

    auto begin = chrono::high_resolution_clock::now();
    //xxx
    auto end = chrono::high_resolution_clock::now();
    cout << "time: " << chrono::duration_cast<chrono::microseconds>(end - begin).count() * 1e-6 << "s" << endl; //秒计时

以上是关于C++中计时函数使用的主要内容,如果未能解决你的问题,请参考以下文章