📜  c++ 测量时间 - C++ 代码示例

📅  最后修改于: 2022-03-11 14:44:55.004000             🧑  作者: Mango

代码示例1
//***C++11 Style:***
#include 

std::chrono::steady_clock::time_point begin = std::chrono::steady_clock::now();
std::chrono::steady_clock::time_point end = std::chrono::steady_clock::now();

std::cout << "Time difference = " << std::chrono::duration_cast(end - begin).count() << "[µs]" << std::endl;
std::cout << "Time difference = " << std::chrono::duration_cast (end - begin).count() << "[ns]" << std::endl;