From 02c142a2dd6925fdaaccb11e64f0ff60fe436b70 Mon Sep 17 00:00:00 2001 From: happysalada Date: Mon, 6 Sep 2021 12:05:15 +0900 Subject: [PATCH] stdenv: fix showBuildStats - remove going through another file - use builtin instead of external cat - improve echo formatting --- pkgs/stdenv/generic/setup.sh | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/pkgs/stdenv/generic/setup.sh b/pkgs/stdenv/generic/setup.sh index e52ea8bdd66c..29c44e9d711e 100644 --- a/pkgs/stdenv/generic/setup.sh +++ b/pkgs/stdenv/generic/setup.sh @@ -121,14 +121,12 @@ exitHandler() { set +e if [ -n "${showBuildStats:-}" ]; then - times > "$NIX_BUILD_TOP/.times" - local -a times=($(cat "$NIX_BUILD_TOP/.times")) - # Print the following statistics: - # - user time for the shell - # - system time for the shell - # - user time for all child processes - # - system time for all child processes - echo "build time elapsed: " "${times[@]}" + read -r -d '' -a buildTimes < <(times) + echo "build times:" + echo "user time for the shell ${buildTimes[0]}" + echo "system time for the shell ${buildTimes[1]}" + echo "user time for all child processes ${buildTimes[2]}" + echo "system time for all child processes ${buildTimes[3]}" fi if (( "$exitCode" != 0 )); then