From 66efed8b335610f9eae59fd3f52eccaffd7a6e0b Mon Sep 17 00:00:00 2001 From: JinweiClarkChao Date: Tue, 25 Aug 2015 16:03:05 +0800 Subject: fix --- DCP/utility.h | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 DCP/utility.h (limited to 'DCP/utility.h') 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 @@ +#ifndef UTILITY_H +#define UTILITY_H + +#include +#include + +class TicToc +{ +private: + typedef std::chrono::high_resolution_clock clock; + typedef std::chrono::microseconds res; + clock::time_point t1, t2; + +public: + void tic() + { + t1 = clock::now(); + } + + void toc() + { + t2 = clock::now(); + std::cout << "Elapsed time: " + << std::chrono::duration_cast(t2 - t1).count() / 1e6 + << " seconds." << std::endl; + } +}; + +#endif \ No newline at end of file -- cgit v1.2.3