1、添加头文件库#include <chrono>
2、代码编写
std::chrono::steady_clock::time_point t1 = std::chrono::steady_clock::now();
std::chrono::steady_clock::time_point t2 = std::chrono::steady_clock::now();
std::chrono::duration<double> time_used12 = std::chrono::duration_cast<std::chrono::duration<double>>(t2 - t1);