From 61b8c03a78caa35a52ac6364106a8d3a46960294 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20=C4=8Cun=C3=A1t?= Date: Sun, 13 Jan 2019 10:31:02 +0100 Subject: [PATCH] metrics job: update for nix-2.2 Fixes https://github.com/NixOS/nixpkgs/issues/53858 I think I managed to keep all numbers the same as before nix-2.2. --- pkgs/top-level/metrics.nix | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/pkgs/top-level/metrics.nix b/pkgs/top-level/metrics.nix index a199f61020c..c4253973cbb 100644 --- a/pkgs/top-level/metrics.nix +++ b/pkgs/top-level/metrics.nix @@ -3,7 +3,7 @@ with pkgs; runCommand "nixpkgs-metrics" - { buildInputs = [ nix time ]; + { nativeBuildInputs = with pkgs.lib; map getBin [ nix time jq ]; requiredSystemFeatures = [ "benchmark" ]; } '' @@ -19,23 +19,26 @@ runCommand "nixpkgs-metrics" shift echo "running $@" - NIX_SHOW_STATS=1 time "$@" 2>&1 > /dev/null | tee stats + NIX_SHOW_STATS=1 time -o stats-time "$@" 2>stats-nix + sed '/^warning:/d' -i stats-nix - cat stats + cat stats-nix; echo; cat stats-time; echo - x=$(sed -e 's/.*time elapsed: \([0-9\.]\+\).*/\1/ ; t ; d' stats) + x=$(jq '.cpuTime' < stats-nix) [[ -n $x ]] || exit 1 echo "$name.time $x s" >> $out/nix-support/hydra-metrics - x=$(sed -e 's/.* \([0-9]\+\)maxresident.*/\1/ ; t ; d' stats) + x=$(sed -e 's/.* \([0-9]\+\)maxresident.*/\1/ ; t ; d' < stats-time) [[ -n $x ]] || exit 1 echo "$name.maxresident $x KiB" >> $out/nix-support/hydra-metrics - x=$(sed -e 's/.*total allocations: \([0-9]\+\) bytes.*/\1/ ; t ; d' stats) + # nix-2.2 also outputs .symbols.bytes but that wasn't summed originally + # https://github.com/NixOS/nix/pull/2392/files#diff-8e6ba8c21672fc1a5f6f606e1e101c74L1762 + x=$(jq '[.envs,.list,.values,.sets] | map(.bytes) | add' < stats-nix) [[ -n $x ]] || exit 1 echo "$name.allocations $x B" >> $out/nix-support/hydra-metrics - x=$(sed -e 's/.*values allocated count: \([0-9]\+\).*/\1/ ; t ; d' stats) + x=$(jq '.values.number' < stats-nix) [[ -n $x ]] || exit 1 echo "$name.values $x" >> $out/nix-support/hydra-metrics } @@ -52,7 +55,9 @@ runCommand "nixpkgs-metrics" num=$(nix-env -f ${nixpkgs} -qa | wc -l) echo "nix-env.qaCount $num" >> $out/nix-support/hydra-metrics - export GC_INITIAL_HEAP_SIZE=128k + # TODO: this has been ignored for some time + # GC Warning: Bad initial heap size 128k - ignoring it. + #export GC_INITIAL_HEAP_SIZE=128k run nix-env.qaAggressive nix-env -f ${nixpkgs} -qa run nix-env.qaDrvAggressive nix-env -f ${nixpkgs} -qa --drv-path --meta --xml