diff options
Diffstat (limited to 'source/core/slang-performance-profiler.cpp')
| -rw-r--r-- | source/core/slang-performance-profiler.cpp | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/source/core/slang-performance-profiler.cpp b/source/core/slang-performance-profiler.cpp index 9bc532680..bd046f4cc 100644 --- a/source/core/slang-performance-profiler.cpp +++ b/source/core/slang-performance-profiler.cpp @@ -35,15 +35,22 @@ public: char buffer[512]; for (const auto& func : data) { - memset(buffer, 0, sizeof(buffer)); - snprintf(buffer, sizeof(buffer), "[*] %30s", func.key); - out << buffer << " \t"; - auto milliseconds = - std::chrono::duration_cast<std::chrono::milliseconds>(func.value.duration); - out << func.value.invocationCount << " \t" - << static_cast<uint64_t>(milliseconds.count()) << "ms\n"; + auto microseconds = + std::chrono::duration_cast<std::chrono::microseconds>(func.value.duration); + double milliseconds = microseconds.count() / 1000.0; + snprintf( + buffer, + sizeof(buffer), + "[*] %30s \t%d \t%8.2fms\n", + func.key, + func.value.invocationCount, + milliseconds); + + out << buffer; } } + + virtual void clear() override { data.clear(); } virtual void dispose() override { data = decltype(data)(); } }; |
