Skip to content

计时

C++
1
2
3
4
5
6
7
8
9
#include <chrono>

auto start = std::chrono::steady_clock::now();
// func start
// ...
// func end
auto end = std::chrono::steady_clock::now();
std::chrono::duration<double, std::milli> diff = end - start;
std::cout << "cost time: " << diff.count();