summaryrefslogtreecommitdiff
path: root/src/command_manager.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/command_manager.cc')
-rw-r--r--src/command_manager.cc12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/command_manager.cc b/src/command_manager.cc
index cb7ddf82..e1e11b52 100644
--- a/src/command_manager.cc
+++ b/src/command_manager.cc
@@ -508,9 +508,17 @@ void CommandManager::execute_single_command(CommandParameters params,
if (command_it == m_commands.end())
throw command_not_found(params[0]);
- const DebugFlags debug_flags = context.options()["debug"].get<DebugFlags>();
+ auto debug_flags = context.options()["debug"].get<DebugFlags>();
+ auto start = (debug_flags & DebugFlags::Profile) ? Clock::now() : Clock::time_point{};
if (debug_flags & DebugFlags::Commands)
- write_to_debug_buffer(format("command {} {}", params[0], join(param_view, ' ')));
+ write_to_debug_buffer(format("command {}", join(params, ' ')));
+
+ on_scope_end([&] {
+ if (not (debug_flags & DebugFlags::Profile))
+ return;
+ auto full = std::chrono::duration_cast<std::chrono::microseconds>(Clock::now() - start);
+ write_to_debug_buffer(format("command {} took {} us", params[0], full.count()));
+ });
try
{