diff options
author | Klaus Aehlig <klaus.aehlig@huawei.com> | 2025-03-03 17:10:54 +0100 |
---|---|---|
committer | Klaus Aehlig <klaus.aehlig@huawei.com> | 2025-03-10 16:28:59 +0100 |
commit | 4768bf9c2d66c4ef0c5535d9862d2b3b7093c15e (patch) | |
tree | dd33f551091d5243b8b93399a8340b5728e74a99 /src/buildtool/execution_api/local/local_action.cpp | |
parent | 104720a10bdf154a633a7aa1b9a8b6dc9d4fddc9 (diff) | |
download | justbuild-4768bf9c2d66c4ef0c5535d9862d2b3b7093c15e.tar.gz |
local actions: return duration
Diffstat (limited to 'src/buildtool/execution_api/local/local_action.cpp')
-rw-r--r-- | src/buildtool/execution_api/local/local_action.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/buildtool/execution_api/local/local_action.cpp b/src/buildtool/execution_api/local/local_action.cpp index 0d73d923..9764245c 100644 --- a/src/buildtool/execution_api/local/local_action.cpp +++ b/src/buildtool/execution_api/local/local_action.cpp @@ -15,6 +15,7 @@ #include "src/buildtool/execution_api/local/local_action.hpp" #include <algorithm> +#include <chrono> #include <cstddef> #include <exception> #include <filesystem> @@ -203,8 +204,10 @@ auto LocalAction::Run(ArtifactDigest const& action_id) const noexcept std::copy(cmdline_.begin(), cmdline_.end(), std::back_inserter(cmdline)); SystemCommand system{"LocalExecution"}; + auto start_time = std::chrono::system_clock::now(); auto const exit_code = system.Execute(cmdline, env_vars_, build_root / cwd_, *exec_path); + auto end_time = std::chrono::system_clock::now(); if (exit_code.has_value()) { Output result{}; result.action.set_exit_code(*exit_code); @@ -226,6 +229,8 @@ auto LocalAction::Run(ArtifactDigest const& action_id) const noexcept } } } + result.duration = + std::chrono::duration<double>(end_time - start_time).count(); return result; } |