aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'DCP/utility.h')
-rw-r--r--DCP/utility.h29
1 files changed, 29 insertions, 0 deletions
diff --git a/DCP/utility.h b/DCP/utility.h
new file mode 100644
index 0000000..55cc100
--- /dev/null
+++ b/DCP/utility.h
@@ -0,0 +1,29 @@
1#ifndef UTILITY_H
2#define UTILITY_H
3
4#include <iostream>
5#include <chrono>
6
7class TicToc
8{
9private:
10 typedef std::chrono::high_resolution_clock clock;
11 typedef std::chrono::microseconds res;
12 clock::time_point t1, t2;
13
14public:
15 void tic()
16 {
17 t1 = clock::now();
18 }
19
20 void toc()
21 {
22 t2 = clock::now();
23 std::cout << "Elapsed time: "
24 << std::chrono::duration_cast<res>(t2 - t1).count() / 1e6
25 << " seconds." << std::endl;
26 }
27};
28
29#endif \ No newline at end of file
Powered by cgit v1.2.3 (git 2.41.0)