| 2154 | } |
| 2155 | |
| 2156 | uint64_t GetThreadId() { |
| 2157 | uint64_t equiv{0}; |
| 2158 | // std::thread::id is trivially copyable as per C++ spec, |
| 2159 | // so type punning as a uint64_t should work |
| 2160 | static_assert(sizeof(std::thread::id) <= sizeof(uint64_t), |
| 2161 | "std::thread::id can't fit into uint64_t"); |
| 2162 | const auto tid = std::this_thread::get_id(); |
| 2163 | memcpy(&equiv, reinterpret_cast<const void*>(&tid), sizeof(tid)); |
| 2164 | return equiv; |
| 2165 | } |
| 2166 | |
| 2167 | // Returns the current resident set size (physical memory use) measured |
| 2168 | // in bytes, or zero if the value cannot be determined on this OS. |
no outgoing calls
no test coverage detected