diff options
| author | Maxime Coste <mawww@kakoune.org> | 2017-06-07 20:06:47 +0100 |
|---|---|---|
| committer | Maxime Coste <mawww@kakoune.org> | 2017-06-07 20:06:47 +0100 |
| commit | b81500c0e4c5dac5c976fc5553658d9f009ddf00 (patch) | |
| tree | 0fe795e4df9f03bdc1c047b20231aa9462259a06 /src | |
| parent | 1c0bdd8c8549f71a70090a2be0bb17d12c66ea03 (diff) | |
Use microseconds instead of milliseconds for built-in profiling
Diffstat (limited to 'src')
| -rw-r--r-- | src/hash_map.cc | 11 | ||||
| -rw-r--r-- | src/hook_manager.cc | 4 | ||||
| -rw-r--r-- | src/shell_manager.cc | 8 | ||||
| -rw-r--r-- | src/window.cc | 4 |
4 files changed, 14 insertions, 13 deletions
diff --git a/src/hash_map.cc b/src/hash_map.cc index 5799f87b..95b75f18 100644 --- a/src/hash_map.cc +++ b/src/hash_map.cc @@ -115,11 +115,12 @@ void do_profile(size_t count, StringView type) } auto after_find = Clock::now(); - write_to_debug_buffer(format("{} ({}) -- inserts: {}ms, reads: {}ms, remove: {}ms, find: {}ms ({})", type, count, - std::chrono::duration_cast<std::chrono::milliseconds>(after_insert - start).count(), - std::chrono::duration_cast<std::chrono::milliseconds>(after_read - after_insert).count(), - std::chrono::duration_cast<std::chrono::milliseconds>(after_remove - after_read).count(), - std::chrono::duration_cast<std::chrono::milliseconds>(after_find - after_remove).count(), + using namespace std::chrono; + write_to_debug_buffer(format("{} ({}) -- inserts: {}us, reads: {}us, remove: {}us, find: {}us ({})", type, count, + duration_cast<microseconds>(after_insert - start).count(), + duration_cast<microseconds>(after_read - after_insert).count(), + duration_cast<microseconds>(after_remove - after_read).count(), + duration_cast<microseconds>(after_find - after_remove).count(), c)); } diff --git a/src/hook_manager.cc b/src/hook_manager.cc index ef7139b3..fc274f8a 100644 --- a/src/hook_manager.cc +++ b/src/hook_manager.cc @@ -128,8 +128,8 @@ void HookManager::run_hook(StringView hook_name, if (profile) { auto end_time = Clock::now(); - auto full = std::chrono::duration_cast<std::chrono::milliseconds>(end_time - start_time); - write_to_debug_buffer(format("hook '{}({})' took {} ms", hook_name, param, (size_t)full.count())); + auto full = std::chrono::duration_cast<std::chrono::microseconds>(end_time - start_time); + write_to_debug_buffer(format("hook '{}({})' took {} us", hook_name, param, (size_t)full.count())); } } diff --git a/src/shell_manager.cc b/src/shell_manager.cc index f34b611d..ba6939d0 100644 --- a/src/shell_manager.cc +++ b/src/shell_manager.cc @@ -280,10 +280,10 @@ std::pair<String, int> ShellManager::eval( if (profile) { auto end_time = Clock::now(); - auto full = duration_cast<milliseconds>(end_time - start_time); - auto spawn = duration_cast<milliseconds>(wait_time - spawn_time); - auto wait = duration_cast<milliseconds>(end_time - wait_time); - write_to_debug_buffer(format("shell execution took {} ms (spawn: {}, wait: {})", + auto full = duration_cast<microseconds>(end_time - start_time); + auto spawn = duration_cast<microseconds>(wait_time - spawn_time); + auto wait = duration_cast<microseconds>(end_time - wait_time); + write_to_debug_buffer(format("shell execution took {} us (spawn: {}, wait: {})", (size_t)full.count(), (size_t)spawn.count(), (size_t)wait.count())); } diff --git a/src/window.cc b/src/window.cc index 262c6979..1dee2c2a 100644 --- a/src/window.cc +++ b/src/window.cc @@ -147,8 +147,8 @@ const DisplayBuffer& Window::update_display_buffer(const Context& context) if (profile and not (buffer().flags() & Buffer::Flags::Debug)) { using namespace std::chrono; - auto duration = duration_cast<milliseconds>(Clock::now() - start_time); - write_to_debug_buffer(format("window display update for '{}' took {} ms", + auto duration = duration_cast<microseconds>(Clock::now() - start_time); + write_to_debug_buffer(format("window display update for '{}' took {} us", buffer().display_name(), (size_t)duration.count())); } |
