summaryrefslogtreecommitdiff
path: root/src/shell_manager.cc
diff options
context:
space:
mode:
authorMaxime Coste <frrrwww@gmail.com>2016-05-06 00:24:54 +0100
committerMaxime Coste <frrrwww@gmail.com>2016-05-06 00:24:54 +0100
commit457e11bdc904555edddaa2956236e56ae4cd5971 (patch)
treefaa227a2ef5f1dc0878f4fa2d9ac01149ed89fd8 /src/shell_manager.cc
parentbab174b0ec98cb2ff5759477576145bb8b16b5f7 (diff)
time window display buffer update in debug profile mode
Diffstat (limited to 'src/shell_manager.cc')
-rw-r--r--src/shell_manager.cc17
1 files changed, 8 insertions, 9 deletions
diff --git a/src/shell_manager.cc b/src/shell_manager.cc
index cfc364cd..e0345e36 100644
--- a/src/shell_manager.cc
+++ b/src/shell_manager.cc
@@ -115,19 +115,18 @@ std::pair<String, int> ShellManager::eval(
StringView cmdline, const Context& context, StringView input,
Flags flags, const ShellContext& shell_context)
{
- using Clock = std::chrono::steady_clock;
- using TimePoint = Clock::time_point;
+ using namespace std::chrono;
const DebugFlags debug_flags = context.options()["debug"].get<DebugFlags>();
const bool profile = debug_flags & DebugFlags::Profile;
if (debug_flags & DebugFlags::Shell)
write_to_debug_buffer(format("shell:\n{}\n----\n", cmdline));
- auto start_time = profile ? Clock::now() : TimePoint{};
+ auto start_time = profile ? steady_clock::now() : steady_clock::time_point{};
auto kak_env = generate_env(cmdline, context, shell_context);
- auto spawn_time = profile ? Clock::now() : TimePoint{};
+ auto spawn_time = profile ? steady_clock::now() : steady_clock::time_point{};
Pipe child_stdin{not input.empty()}, child_stdout, child_stderr;
pid_t pid = spawn_shell(cmdline, shell_context.params, kak_env,
@@ -154,7 +153,7 @@ std::pair<String, int> ShellManager::eval(
write(child_stdin.write_fd(), input);
child_stdin.close_write_fd();
- auto wait_time = profile ? Clock::now() : TimePoint{};
+ auto wait_time = profile ? steady_clock::now() : steady_clock::time_point{};
struct PipeReader : FDWatcher
{
@@ -204,10 +203,10 @@ std::pair<String, int> ShellManager::eval(
if (profile)
{
- TimePoint end_time = Clock::now();
- auto full = std::chrono::duration_cast<std::chrono::milliseconds>(end_time - start_time);
- auto spawn = std::chrono::duration_cast<std::chrono::milliseconds>(wait_time - spawn_time);
- auto wait = std::chrono::duration_cast<std::chrono::milliseconds>(end_time - wait_time);
+ auto end_time = steady_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: {})",
(size_t)full.count(), (size_t)spawn.count(), (size_t)wait.count()));
}