Last active
August 29, 2015 14:03
-
-
Save qi7chen/3d11f2cc50421af30ca9 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #pragma once | |
| #include <time.h> | |
| #include <stdint.h> | |
| #include <array> | |
| typedef std::array<uint8_t, 16> UUID_T; | |
| #ifdef _MSC_VER | |
| #pragma optimize("", off) | |
| template <class T> | |
| void doNotOptimizeAway(T&& datum) { | |
| datum = datum; | |
| } | |
| #pragma optimize("", on) | |
| #else | |
| template <class T> | |
| void doNotOptimizeAway(T&& datum) { | |
| asm volatile("" : "+r" (datum)); | |
| } | |
| #endif | |
| class TimeCounter | |
| { | |
| public: | |
| TimeCounter(); | |
| ~TimeCounter(); | |
| private: | |
| #ifdef _WIN32 | |
| uint32_t start_; | |
| #else | |
| timespec start_; | |
| #endif | |
| }; | |
| UUID_T createUUID(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment