| 84 | } |
| 85 | |
| 86 | const std::string Profiler::timerInit(const int line, const std::string& function, const std::string& file) |
| 87 | { |
| 88 | #ifdef PROFILER_ENABLED |
| 89 | const auto key = getKey(line, function, file); |
| 90 | std::unique_lock<std::mutex> lock{sMutexProfiler}; |
| 91 | if (sProfilerTuple.count(key) > 0) |
| 92 | std::get<2>(sProfilerTuple[key]) = std::chrono::high_resolution_clock::now(); |
| 93 | else |
| 94 | sProfilerTuple[key] = {std::make_tuple(0., 0ull, std::chrono::high_resolution_clock::now())}; |
| 95 | lock.unlock(); |
| 96 | return key; |
| 97 | #else |
| 98 | UNUSED(line); |
| 99 | UNUSED(function); |
| 100 | UNUSED(file); |
| 101 | return ""; |
| 102 | #endif |
| 103 | } |
| 104 | |
| 105 | void Profiler::timerEnd(const std::string& key) |
| 106 | { |