diff options
author | JinweiClarkChao <[email protected]> | 2015-08-25 16:03:05 +0800 |
---|---|---|
committer | JinweiClarkChao <[email protected]> | 2015-08-25 16:49:50 +0800 |
commit | 66efed8b335610f9eae59fd3f52eccaffd7a6e0b (patch) | |
tree | a65d3ad57aa75d072b5f543fd5ea5c0a18a5c1ab /DCP/utility.h | |
parent | f07885c1eb4c98dc52704517623b2e7df1ed616d (diff) | |
download | Dehaze-66efed8b335610f9eae59fd3f52eccaffd7a6e0b.tar.gz |
fix
Diffstat (limited to 'DCP/utility.h')
-rw-r--r-- | DCP/utility.h | 29 |
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 | |||
7 | class TicToc | ||
8 | { | ||
9 | private: | ||
10 | typedef std::chrono::high_resolution_clock clock; | ||
11 | typedef std::chrono::microseconds res; | ||
12 | clock::time_point t1, t2; | ||
13 | |||
14 | public: | ||
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 | ||