| 120 | |
| 121 | template<typename T> |
| 122 | void measure(std::string s, T func) |
| 123 | { |
| 124 | auto t0 = std::chrono::steady_clock::now(); |
| 125 | func(1000); // measure |
| 126 | auto t1 = std::chrono::steady_clock::now(); |
| 127 | std::chrono::duration<double, std::milli> diff{ t1 - t0 }; |
| 128 | std::cout << s << ": " << diff.count() << "ms\n "; |
| 129 | func(1); // show output |
| 130 | } |
| 131 | |
| 132 | int main() |
| 133 | { |